Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*/
// eslint-disable-next-line no-undef
if (!CMS_MANUAL_INIT) {
CMS.init()
} else {
console.log(
`\`CMS_MANUAL_INIT\` flag set, skipping automatic initialization.'`
)
}
// eslint-disable-next-line no-undef
if (PRODUCTION) {
/**
* The stylesheet output from the modules at `modulePath` will be at `cms.css`.
*/
CMS.registerPreviewStyle(`cms.css`)
} else {
/**
* In development styles are injected dynamically via the style-loader plugin
*/
window.addEventListener(`DOMContentLoaded`, event => {
const list = document.querySelectorAll(`link[rel='stylesheet']`)
list.forEach(({ href }) => {
CMS.registerPreviewStyle(href)
})
})
}
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})
})
import CMS from 'netlify-cms-app'
import '../assets/sass/styles.sass'
import HomePagePreview from './preview-templates/HomePagePreview'
import AboutPagePreview from './preview-templates/AboutPagePreview'
import ArticlePreview from './preview-templates/ArticlePreview'
import PricingPagePreview from './preview-templates/PricingPagePreview'
import ContactPagePreview from './preview-templates/ContactPagePreview'
CMS.init()
CMS.registerPreviewStyle('/styles.css')
CMS.registerPreviewTemplate('home', HomePagePreview)
CMS.registerPreviewTemplate('about', AboutPagePreview)
CMS.registerPreviewTemplate('pricing', PricingPagePreview)
CMS.registerPreviewTemplate('contact', ContactPagePreview)
CMS.registerPreviewTemplate('blog', ArticlePreview)
list.forEach(({ href }) => {
CMS.registerPreviewStyle(href)
})
})
import React from 'react'
import CMS from 'netlify-cms-app'
import './cms-utils'
import { HomePageTemplate } from '../templates/HomePage'
import { ComponentsPageTemplate } from '../templates/ComponentsPage'
import { ContactPageTemplate } from '../templates/ContactPage'
import { DefaultPageTemplate } from '../templates/DefaultPage'
import { BlogIndexTemplate } from '../templates/BlogIndex'
import { SinglePostTemplate } from '../templates/SinglePost'
if (
window.location.hostname === 'localhost' &&
window.localStorage.getItem('netlifySiteURL')
) {
CMS.registerPreviewStyle(
window.localStorage.getItem('netlifySiteURL') + '/styles.css'
)
} else {
CMS.registerPreviewStyle('/styles.css')
}
CMS.registerPreviewTemplate('home-page', ({ entry }) => (
))
CMS.registerPreviewTemplate('components-page', ({ entry }) => (
))
CMS.registerPreviewTemplate('contact-page', ({ entry }) => (
))
CMS.registerPreviewTemplate('infoPages', ({ entry }) => (
import { HomePageTemplate } from '../templates/HomePage'
import { ComponentsPageTemplate } from '../templates/ComponentsPage'
import { ContactPageTemplate } from '../templates/ContactPage'
import { DefaultPageTemplate } from '../templates/DefaultPage'
import { BlogIndexTemplate } from '../templates/BlogIndex'
import { SinglePostTemplate } from '../templates/SinglePost'
if (
window.location.hostname === 'localhost' &&
window.localStorage.getItem('netlifySiteURL')
) {
CMS.registerPreviewStyle(
window.localStorage.getItem('netlifySiteURL') + '/styles.css'
)
} else {
CMS.registerPreviewStyle('/styles.css')
}
CMS.registerPreviewTemplate('home-page', ({ entry }) => (
))
CMS.registerPreviewTemplate('components-page', ({ entry }) => (
))
CMS.registerPreviewTemplate('contact-page', ({ entry }) => (
))
CMS.registerPreviewTemplate('infoPages', ({ entry }) => (
))
CMS.registerPreviewTemplate('blog-page', ({ entry }) => (