Issue #890Opened February 22, 2018by ekennedy800 reactions

[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)

maxtaccoFebruary 22, 20180 reactions

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.

artfMarch 1, 20180 reactions

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>
ekennedy80March 11, 20180 reactions

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.