@ajshortt/nuxt-datocms
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

Nuxt DatoCMS Plugin


⚠️ This module is currently in development: It is not ready for production use


npm version npm downloads License

NuxtJS plugin that creates a clean and elegant way to fetch data from DatoCMS.

📖 Release Notes

Setup

  1. Add @ajshortt/nuxt-datocms dependency to your project
yarn add @ajshortt/nuxt-datocms # or npm install @ajshortt/nuxt-datocms
  1. Add nuxt-datocms to the modules section of nuxt.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
    }
  }
}
  1. Test fetching data from DatoCMS within a page's asyncData lifecycle 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 docs

Install dependencies and start the project in development mode:

yarn && yarn dev

Development

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Start development server using npm run dev

License

MIT License

Copyright (c) Alex Shortt hello@alex-shortt.com

Package Sidebar

Install

npm i @ajshortt/nuxt-datocms

Weekly Downloads

1

Version

0.0.7

License

MIT

Unpacked Size

11.1 kB

Total Files

8

Last publish

Collaborators

  • ajshortt