grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

In React How to give local css path for grapesjs editor ?

Open suresh5 opened this issue 7 years ago • 4 comments

As I am working in Reactjs with grapesjs, I want to load html template in to grapesjs.I am having separate css folder in my local react application ? How to load that css when grapesks editor initializing

suresh5 avatar Dec 12 '18 13:12 suresh5

grapesjs.init({
  canvas: {
    styles: ["style.css"]
  },
  ...
})

cjpollard avatar Dec 12 '18 13:12 cjpollard

grapesjs.init({
  canvas: {
    styles: ["style.css"]
  },
  ...
})

where to store that css file ? i mean path to keep that file in react

suresh5 avatar Jan 22 '19 07:01 suresh5

Depends how you're bundling and serving your pages. For example, if you're serving a build folder, with the CSS in a subfolder there, then use '/css/style.css'.

cjpollard avatar Jan 25 '19 09:01 cjpollard

im working with vue and grapes s i want lo load a loacal html file and display inside the editor, i'm new to grapesjs please tell me is there any way of loading a local html file into grapes js Thanks in advance . mycode

mounted() { const LandingPage = { html: '../userpage/index.html', css: ['../userpage/style.css','../userpage/css.css','../userpage/bootstrap.min.css'], components: null, style: null, }; this.editor = grapesjs.init({ container: "#gjs", canvas: { styles: ["../userpage/style.css"], html:"../userpage/index.html" }, fromElement: true, components: LandingPage.components || LandingPage.html, style: LandingPage.style || LandingPage.css, plugins: [], pluginsOpts: { "gjs-preset-webpage": {} }, storageManager: { type: 'local', stepsBeforeSave: 10, urlStore: '', urlLoad: '', params: {}, headers: {}, }, }); }

raghuv9 avatar Sep 10 '19 08:09 raghuv9