question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading a previously saved document has wrong CSS

See original GitHub issue

I’m trying to save and then load the template with CSS. Everything’s fine until I try to reload the page. Each reload keeps adding a group of CSS definitions, not sure where they’re coming from:

body{
  margin-top:0px;
  margin-right:0px;
  margin-bottom:0px;
  margin-left:0px;
  height:auto;
  background-image:initial;
  background-position-x:initial;
  background-position-y:initial;
  background-size:initial;
  background-repeat-x:initial;
  background-repeat-y:initial;
  background-attachment:initial;
  background-origin:initial;
  background-clip:initial;
  background-color:rgb(255, 255, 255);
}
#wrapper{
  min-height:100%;
  overflow-x:auto;
  overflow-y:auto;
}
*{
  box-sizing:border-box;
}

Note that each reload will add these definitions even though they’re already there (CSS definitions will grow after each reload). I use chrome.

Here’s the minimum amount of code to reproduce this problem:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Fuxrank Editor</title>
    <link rel="stylesheet" href="/grapesjs/dist/css/grapes.min.css">
    <style>
        body, html{ height: 100%; margin: 0;}
        .editor {
            height: 100%;
        }
    </style>
</head>
<body>
<div class="editor">
    <div id="gjs" style="height:0px; overflow:hidden"></div>
</div>
<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="/grapesjs/dist/grapes.min.js"></script>
<script type="text/javascript">
    var editor = grapesjs.init({
        container: '#gjs',
        fromElement: false,
        height: '100%',
        storageManager: {
            id: 'gjs-',
            type: 'local',
            autosave: 1,
            autoload: 1,
            stepsBeforeSave: 1,
            storeComponents: 1,
            storeStyles: 1,
            storeHtml: 1,
            storeCss: 1,
        },
    });
    window.editor = editor;

</script>
</body>
</html>

To reproduce:

  • load the page
  • add few blocks/components
  • export the template and review the CSS
  • reload the page and review the CSS again
  • reload the page and review the CSS again

With local storage CSS definitions are truncated after few reloads. With remote storage they just grow.

1-add-components 2-reload 3-reload-again

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jakzalcommented, May 18, 2017

I have recently updated grapesjs and the problem is no longer there.

Thank you for all your hard work. The project is awesome!

0reactions
lock[bot]commented, Sep 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML not loading CSS file
It seems the HTML file can't load the CSS for some reason, even though both are in the same directory. Any idea what...
Read more >
How to Fix CSS file is not Working with HTML in Chrome
Fix CSS file is not Working with HTML in Chrome | Problem Solved Show SupportBuy Me a COFFEE: https://buymeacoffee.com/Webjahin  ...
Read more >
Handling common HTML and CSS problems - MDN Web Docs
Basically, it is a matter of checking whether your HTML and CSS code is well formed and doesn't contain any syntax errors. Note:...
Read more >
Solving the React Error: Not Picking Up CSS Style
Here, the CSS file is saved outside the src folder, so the compiler failed to import it. To make this code work, you...
Read more >
Recover an earlier version of a Word file
Recover saved and unsaved documents. ... If the AutoRecover option is turned on, you can automatically save versions of your file while you're...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found