Question: How to use same CSS for Multiple pages
Question
Hello Grapejs Team,
We've been working on Multi-page Website Builder.
For each project there will be multiple html pages with single common "style.css" page.
I am lazy loading each page with the following function - for handling multiple page loads
loadPage(pageId: string, cssPageId) {
this.pageService.getEntity(pageId).subscribe(currentpage => {
this.htmlPage = currentpage;
this.editor.setComponents(currentpage.content);
});
this.pageService.getEntity(cssPageId).subscribe(stylepage => {
this.cssPage = stylepage;
this.editor.setStyle(stylepage.content);
});
}
The above page loads the page properly however, if page is empty or different from previous page it removes certain CSS classes. It's not perfectly loading the entire css file.
Am I missing something?
How can I have a common CSS file? Whether there is any workaround. Please help me with this issue.
Thanks for your great work and support :)
Answers (3)
This should work.
var editor = grapesjs.init({ keepUnusedStyles: true, ... });
@inventorbit next time, if someone solves your issue, close it
@cjpollard Thank you very much :) It's working. You saved my time...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #811
[QUESTION] CSS Gets deleted
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...
Issue #954
[Question] Drag&drop of button on demo has additional css attributes
Hi, On the newsletter demo, when drag&dropping a button, some additional css attributes are added to the <a>. It seems like they come from...
Issue #822
[QUESTION] How to get the html and css code in view code tool?
or how to get all the html code and css so that I could save it in my database. Or there is already a functionality in the documentation? y...
Issue #1167
[QUESTION] export options
Hi @artf, Are there any other export options than HTML/CSS ? I'm thinking of a way to directly load the configuration from a remote server...
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.