DEV Community

Discussion on: Netlify CMS with Gatsby - Best Option with Some Quirks

Collapse
 
p4lm profile image
Henrik Sommerfeld

For local development I have to following code in cms.js:

const isDevelopment = process.env.NODE_ENV === 'development';

if (isDevelopment) {
  window.CMS_ENV = 'localhost_development';
  const fileSystemBackend = require('netlify-cms-backend-fs');
  CMS.registerBackend('file-system', fileSystemBackend);
}

config.yml then contains the following:

localhost_development:
  backend:
    name: file-system
    api_root: /api

Checkout the linked files or clone the entire repo to see how it fits together.