0.0.7 • Published 4 years ago
@ajshortt/nuxt-datocms v0.0.7
Nuxt DatoCMS Plugin
:warning: This module is currently in development: It is not ready for production use
NuxtJS plugin that creates a clean and elegant way to fetch data from DatoCMS.
Setup
- Add
@ajshortt/nuxt-datocmsdependency to your project
yarn add @ajshortt/nuxt-datocms # or npm install @ajshortt/nuxt-datocms- Add
nuxt-datocmsto themodulessection ofnuxt.config.js
/// nuxt.config.js
{
modules: [
// Simple usage
['nuxt-datocms', {
options: {
datoToken: <DATO-API-TOKEN> // Add Dato API token
}
}]
]
}Or a separate section nuxt-datocms for module options:
// nuxt.config.js
{
modules: [
// Simple usage
'nuxt-datocms',
],
'nuxt-datocms': {
options: {
datoToken: <DATO-API-TOKEN> // Add Dato API token
}
}
}- Test fetching data from DatoCMS within a page's
asyncDatalifecycle method.
async asyncData({ $cms }) {
const data = await $cms.records.fetchRaw(`query {
_site {
locales
}
}`)
console.log(data)
}Documentation
For all configuration, further setup and usage information, please do the following
Move to the docs directory:
cd docsInstall dependencies and start the project in development mode:
yarn && yarn devDevelopment
- Clone this repository
- Install dependencies using
yarn installornpm install - Start development server using
npm run dev
License
Copyright (c) Alex Shortt hello@alex-shortt.com