How to use the netlify-cms.registerPreviewStyle function in netlify-cms

To help you get started, we’ve selected a few netlify-cms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github danielmahon / gatsby-starter-procyon / src / cms / cms.js View on Github external
manager.forEach(reg => {
        reg.forEach(val => {
          sheets += val.sheet.toString();
        });
      });
      CMS.registerPreviewStyle(sheets.toString(), { raw: true });
    }
    render() {
      // Wraps the input component in a container, without mutating it. Good!
      return <template>;
    }
  }
  return withRoot(StyledTemplate);
}

CMS.registerPreviewStyle(globalStyles);
CMS.registerPreviewTemplate('home', withPreviewStyles(HomePagePreview));
CMS.registerPreviewTemplate('about', withPreviewStyles(AboutPagePreview));
CMS.registerPreviewTemplate('blog', withPreviewStyles(BlogPostPreview));
</template>
github ekoeryanto / netlify-cms-widgets / examples / src / module.js View on Github external
import './boot'
import 'netlify-cms/dist/cms.css'
import { config } from './config'
import CMS, { init } from 'netlify-cms'
import NetlifyCMSWidgetColor from 'netlify-cms-widget-color'
import NetlifyCMSWidgetNativeColor from 'netlify-cms-widget-native-color'
import * as NetlifyCMSWidgetMaterialIcons from 'netlify-cms-widget-material-icons'
import * as NetlifyCMSWidgetFontawesome from 'netlify-cms-widget-fontawesome'

CMS.registerWidget('color', NetlifyCMSWidgetColor)

CMS.registerWidget('native-color', NetlifyCMSWidgetNativeColor)

CMS.registerWidget('material-icons', NetlifyCMSWidgetMaterialIcons.Control, NetlifyCMSWidgetMaterialIcons.Preview)
CMS.registerPreviewStyle('https://fonts.googleapis.com/css?family=Material+Icons')

CMS.registerWidget('fontawesome-solid', NetlifyCMSWidgetFontawesome.Solid, NetlifyCMSWidgetFontawesome.Preview)
CMS.registerWidget('fontawesome-regular', NetlifyCMSWidgetFontawesome.Regular, NetlifyCMSWidgetFontawesome.Preview)
CMS.registerWidget('fontawesome-brands', NetlifyCMSWidgetFontawesome.Brands, NetlifyCMSWidgetFontawesome.Preview)

init({ config })
github QardsJs / qards / src / cms / cms.ts View on Github external
import PostsPreview from './previews/posts';

init({
	config: {
		...config,
		collections: [
			settingsCollection,
			authorsCollection,
			categoriesCollection,
			postsCollection,
		],
	},
});

//	load stylesheets
CMS.registerPreviewStyle(typography.toString(), {raw: true});
CMS.registerPreviewStyle(appStyles.toString(), {raw: true});

//	register widgets
CMS.registerWidget('color', ColorWidget.Control);

//	register editor components
CMS.registerEditorComponent(Code);
CMS.registerEditorComponent(Audio);
CMS.registerEditorComponent(Video);
CMS.registerEditorComponent(Image);
CMS.registerEditorComponent(Reveal);
CMS.registerEditorComponent(Calout);
CMS.registerEditorComponent(Divider);
CMS.registerEditorComponent(Gallery);
CMS.registerEditorComponent(Reference);
CMS.registerEditorComponent(Countdown);
github QardsJs / qards / src / cms / cms.ts View on Github external
init({
	config: {
		...config,
		collections: [
			settingsCollection,
			authorsCollection,
			categoriesCollection,
			postsCollection,
		],
	},
});

//	load stylesheets
CMS.registerPreviewStyle(typography.toString(), {raw: true});
CMS.registerPreviewStyle(appStyles.toString(), {raw: true});

//	register widgets
CMS.registerWidget('color', ColorWidget.Control);

//	register editor components
CMS.registerEditorComponent(Code);
CMS.registerEditorComponent(Audio);
CMS.registerEditorComponent(Video);
CMS.registerEditorComponent(Image);
CMS.registerEditorComponent(Reveal);
CMS.registerEditorComponent(Calout);
CMS.registerEditorComponent(Divider);
CMS.registerEditorComponent(Gallery);
CMS.registerEditorComponent(Reference);
CMS.registerEditorComponent(Countdown);
CMS.registerEditorComponent(SectionHeading);
github danielmahon / gatsby-starter-procyon / src / cms / cms.js View on Github external
componentDidMount() {
      const manager = this.props.pageContext.sheetsManager;
      let sheets = '';
      manager.forEach(reg => {
        reg.forEach(val => {
          sheets += val.sheet.toString();
        });
      });
      CMS.registerPreviewStyle(sheets.toString(), { raw: true });
    }
    render() {
github gethypervisual / gridsome-plugin-netlify-cms / lib / cms.js View on Github external
import CMS from 'netlify-cms'
import injectPlugins from './inject-plugins'
import './preview-styles.css'

injectPlugins(CMS)
CMS.registerPreviewStyle(`cms.css`)
github Jinksi / gatsbro / src / cms / cms.js View on Github external
import React from 'react'
import CMS from 'netlify-cms'
import './cms-utils'

import { HomePageTemplate } from '../templates/HomePage'
import { AboutPageTemplate } from '../templates/AboutPage'
import { ContactPageTemplate } from '../templates/ContactPage'
import { DefaultPageTemplate } from '../templates/DefaultPage'
import { BlogIndexTemplate } from '../templates/BlogIndex'
import { SinglePostTemplate } from '../templates/SinglePost'

CMS.registerPreviewStyle('/styles.css')

CMS.registerPreviewTemplate('home-page', ({ entry }) =&gt; (
  
))
CMS.registerPreviewTemplate('about-page', ({ entry }) =&gt; (
  
))
CMS.registerPreviewTemplate('contact-page', ({ entry }) =&gt; (
  
))
CMS.registerPreviewTemplate('infoPages', ({ entry }) =&gt; (
  
))
CMS.registerPreviewTemplate('blog-page', ({ entry }) =&gt; (
  
))