Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
React.useEffect(() => {
if (process.env.NODE_ENV === 'development') {
// const FileSystemBackend = import('netlify-cms-backend-fs');
// console.log('FileSystemBackend', FileSystemBackend)
config.backend = {
"name": "file-system",
"api_root": "http://localhost:3000/api"
}
CMS.registerBackend('file-system', FileSystemBackend);
}
CMS.registerPreviewTemplate('authors', AuthorsPreview);
CMS.registerEditorComponent(EditorYoutube);
CMS.init({ config });
})
import CMS, { init } from 'netlify-cms-app';
import FileSystemBackend from 'netlify-cms-backend-fs';
import { MdxControl, MdxPreview } from 'netlify-cms-widget-mdx';
import BlogPostPreview from './preview-templates/blog-post-preview';
// If running in development
if (process.env.NODE_ENV === 'development') {
window.CMS_ENV = 'development_overrides'; // Set the CMS_ENV to the development_ overrides.
CMS.registerBackend('file-system', FileSystemBackend); // Register the FileSystemBackend.
}
CMS.registerWidget('mdx', MdxControl, MdxPreview);
CMS.registerPreviewTemplate('blog', BlogPostPreview);
// Start NetlifyCMS
init();
import CMS from 'netlify-cms-app'
import AboutPagePreview from './preview-templates/AboutPagePreview'
import BlogPostPreview from './preview-templates/BlogPostPreview'
import ProductPagePreview from './preview-templates/ProductPagePreview'
import FileSystemBackend from 'netlify-cms-backend-fs'
const config = { }
if (process.env.NODE_ENV === 'development') {
// config.load_config_file = false
config.backend = {
"name": "file-system",
"api_root": "/api"
}
config.display_url = "http://localhost:8000"
CMS.registerBackend('file-system', FileSystemBackend)
} else {
config.backend = {
"name": "github",
"repo": "ADARTA/gatsby-starter-netlify-cms",
"branch": "master"
}
}
CMS.init({config})
CMS.registerPreviewTemplate('about', AboutPagePreview)
CMS.registerPreviewTemplate('products', ProductPagePreview)
CMS.registerPreviewTemplate('blog', BlogPostPreview)
import FileSystemBackend from "netlify-cms-backend-fs"
import CMS, { init } from "netlify-cms-app"
const isClient = typeof window !== "undefined"
const isDevelopment = process.env.NODE_ENV === "development"
if (isClient) {
window.CMS_MANUAL_INIT = true
}
if (isDevelopment) {
// Allows for local development overrides in cms.yaml
window.CMS_ENV = "localhost_development"
// Attach to the file system
CMS.registerBackend("file-system", FileSystemBackend)
}
// @ts-check
// Custom components need refs for validation and thus must be a class.
// Additionally, after , only one child is allowed.
// See https://github.com/netlify/netlify-cms/issues/1346
class MDXWidget extends Component {
render() {
return (
)
}
React.useEffect(() => {
console.log(`CMS [${process.env.NODE_ENV}]`, CMS, )
if (process.env.NODE_ENV === 'development') {
config.load_config_file = false
config.backend = {
"name": "file-system",
"api_root": "http://localhost:3000/api"
}
CMS.registerBackend('file-system', FileSystemBackend);
}
CMS.registerPreviewTemplate("posts", PostPreview);
CMS.registerPreviewStyle(previewStyles, { raw: true });
CMS.registerPreviewTemplate("authors", AuthorsPreview);
CMS.registerPreviewTemplate("general", GeneralPreview);
CMS.registerEditorComponent(EditorYoutube);
CMS.registerWidget("relationKitchenSinkPost", "relation", RelationKitchenSinkPostPreview);
CMS.init({config})
})