/nuxt.js-craft-boilerplate

Basic front-end and back-end boilerplate for Nuxt.js together with Craft 3 and Tailwind CSS.

Primary LanguageJavaScript

Nuxt.js Craft Boilerplate

Basic front-end and back-end boilerplate for Nuxt.js together with Craft 3 and Tailwind CSS.

Nuxt.js

Can be found in the frontend directory.

Build Setup

Copy .env.example to .env and fill in the environmental variables (for GraphQL token see Craft 3 - Installation).

To enable GraphQL IDE support copy graphql.config.example.json to graphql.config.json and execute npm run graphql-schema. This will also generate fragmentTypes.json which will add support for Craft Matrix fields to Apollo.

Sometimes CSS changes may not be visible, this is a weakness of PurgeCSS. To make sure you specific CSS is not purged, add a keyword used in the not visible CSS the whitelist in postcss.config.js.

# install dependencies
$ npm install

# serve with hot reload at localhost:3000
$ npm run dev

# build for production and launch server
$ npm run build
$ npm start

# generate static project (may require extra attention)
$ npm run generate

# generate Tailwind IDE CSS file
$ npm run tailwind-schema

# generate GraphQLs schema
$ npm run graphql-schema

# generate both GraphQLs schema and Tailwind IDE CSS file
$ npm run schemas

Modules

This installation comes pre-installed with the following Nuxt.js modules:

Craft 3

Can be found in the backend directory.

Installation

Requires your own PHP server.

Copy .env.example to .env and fill in the environmental variables.

# install dependencies
$ composer install

To get your GraphQL token, go to Settings → CraftQL → Generate new token → Settings... and make sure that entries, globals and the relevant entry types (News, News Index and Navigation for the default boilerplate) are enabled.

Plugins

Comes pre-installed with CraftQL, SEOmatic, Redactor and Redirect.

For detailed explanation on how things work, checkout Nuxt.js docs.