How to Export CSS linked in Canvas Styles properties
@chiqui3d definitely it shouldn't be added to what is used for storing otherwise you will add those styles twice.
Read full answer below βQuestion
How to export the HTML/CSS in the code view / download as zip. With the stylesheets in styles.css referenced in the grapesjs canvas, but not the unused, actually i am fine with all the styles.css stylesheet, for simple API access for export. If I add the stylesheet in init Yea, Table π Thanks for the good work, let us worry about this easy issue and documenting or leave trace in issue list. Artf should focus more on other amazing features.
Answers (3)
@chiqui3d definitely it shouldn't be added to what is used for storing otherwise you will add those styles twice.
The issue I have is that when I try to export the code using the grapesjs export plugin nothing referenced inside canvas is exported. @Yakito For now, those scripts/styles should be included manually, you can use root option from the export plugin:
Hi @tldrjumps I'm not sure if I properly got your problem. You can simply get all the CSS with editor.getCss(), which also tries to optimize it by removing classes without components. Styles inserted via canvas.styles option are just injected inside the canvas but actually, the editor doesn't see t...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3883
GrapesJS export functionality and 'View Code' functionality and the Canvas not operating in a similar manner with regards to hex colors.
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v91 Reproducible demo link https://...
Issue #1888
[Question] Add custom html inside canvas
Hi there, I'm using grapes to export a custom json with all the information i need, instead of HTML and CSS. For doing that I'm parsing the...
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 #4503
Missing inline styles used by CKEditor when adding raw html components
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chromium v96 Reproducible demo link https:...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βBrowse Plugin Categories
Jump directly to plugin category pages on the marketplace.