[QUESTION] CSS Gets deleted
Question
I have a website with multiple web pages (results-page, category page, home page) and a common css file for all pages (all.css).Within this css file : webpage (classes used) Home page ( class A, class B , class C) Results Page ( class B, class X, class Y ) Category page ( class R, class S , class X)
When I load results-page in grape.js' editor using import plugin, I copy the entire all.css file and place it at the top of results Page in <style> tag. Without making any changes I exported the zip using export plugin and I noticed that the css file within zip has only following classes : A,B,X,Y Which means it has classes combined from all 3 pages but it deleted few classes[ unable to understand why so ] . My expected result was : it will have all the classes of all the webpages (A,B,C,R,S,X,Y).
I want to upload the css of entire website, make few changes in the css of a particular webpage and then replace the original css with downloaded css.
Please help me solve it.
Answers (3)
@RiyaThete to load css into editor, you need to insert it on grapesjs init, something like that:
var editor = grapesjs.init({
[...]
container : '#gjs',
canvas: {
styles: [
'http://url.to/file.css'
]
}
});
Or if you want to include css inline:
<div id="gjs" class="overflow-y max-height-60vh">
<style>
my-class{
color: red;
}
</style>
</div>
@JulyanoF I tried this solution but this does not load all the classes of all my web pages.. it just loads all of the results page and few classes from other pages
deleted few classes[ unable to understand why so ]
Not used classes are not rendered
The suggestion proposed by @JulyanoF is the valid one
it just loads all of the results page and few classes from other pages
You can use as many styles you need
styles: [ '..file1.css', '..file2.css', ...]
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1329
Question: How to use same CSS for Multiple pages
Hello Grapejs Team, We've been working on Multi-page Website Builder. For each project there will be multiple html pages with single common...
Issue #783
[QUESTION] Removing certain css
QUESTION My site consists of various webpages like home-page, category-page, results-page etc. The css for all the pages are in a single cs...
Issue #1693
[BUG|/QUESTION] Strange characters (Â) within CSS/HTML preview; Elements are not deleted completely
BUGAre you using the latest release (older versions are NOT supported)?0.14.50Are you facing the bug with your local copy of GrapesJS or wi...
Issue #1621
Question on css classnames used in demo
In the demo page https://grapesjs.com/demo.html, I see that the elements are centered using a class called container-width.Where can I see...
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.