[Question]: I cannot get the simple example working
Question
I am not new to Javascript but when I try the example:
<link rel="stylesheet" href="path/to/grapes.min.css">
<script src="path/to/grapes.min.js"></script>
<div id="gjs"></div>
<script type="text/javascript">
var editor = grapesjs.init({
container : '#gjs',
components: '<div class="txt-red">Hello world!</div>',
style: '.txt-red{color: red}',
});
</script>
I get a blank page. That is with adding the CSS and Javascript library. Any suggestions on getting this up and running? Looks like an outstanding project!
Answers (3)
I suggest you clone one of the examples using Git and run it using NPM commands included in the project. In your example above I would check the paths to grapes.min.css and grapes.min.js files - make sure you do not get 404 - Not found.
Try with this instead
<link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css
">
<script src="https://unpkg.com/grapesjs"></script>
<div id="gjs"></div>
<script type="text/javascript">
var editor = grapesjs.init({
container : '#gjs',
components: '<div class="txt-red">Hello world!</div>',
style: '.txt-red{color: red}',
});
</script>
Okay, I am building a CMS using JSF 2.2 and I cannot get a simple example working in the web application. But if I test an example using a simple file and browser I can get it to work. Has anyone had any experience using grapsejs with JSF? I cannot get an simple example to work in a JSF environment. Any advice is very appreciated because grapesjs is an excellent project that I'd love to use.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1686
CMS: Grapesjs is not defined
I am trying to use basic Grapesjs editor to CMS. Here's my code: I have installed the grapesjs using NPM. Later I tried running this html f...
Issue #2763
GrapesJs and PHP - store and load data to show in editor and as HTML page as well
I am using GrapesJS to build a simple webpage. I included the script in the following way inside head part : I am using GrapesJS to build a...
Issue #1706
[Question]: How to get href from rte?
I have this rte toolbar where you can type and click 'save' and it's going to create a link for the selected text. but the problem is that...
Issue #383
Best way to load element's css into the properties panel.
Hi Again everyone, GrapeJS is too much fun once you get deep into it. I have a simple question: What's the best way to load the css from a...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.