grapesjs: BUG: Latest version 0.21.6 doesn't come with src folder
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Chrome Version 114.0.5735.199 (Official Build) (64-bit)
Reproducible demo link
N/A
Describe the bug
Latest version 0.21.6 doesn’t come with src
folder
when installing grapesjs using npm
npm install grapesjs@0.21.6
Code of Conduct
- I agree to follow this project’s Code of Conduct
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Reactions: 3
- Comments: 15 (10 by maintainers)
@bgrand-ch I think what you’re mentioning is fixable with CSS variables.
I was also thinking about introducing a new small module for theming, that would allow updating the editor appearance programmatically, and under the hood, it would be a matter of updating internal CSS variables.
it was just one file
scss files are more organized and more powerful that css files but i have a backup plan
because of sass files to overwrite variables it is very important
Solution
clone the repository and run
npm i grapesjs@latest
create a bash function to do this at the same time in.bash_aliases
something like this:extra work, but we used to it.
Sure, grapesjs was one of those, but that doesn’t mean it’s the right approach indeed there are many reasons not to do that. We’d like to be free to restructure/refactor the files and use the appropriate tech stack inside the source without breaking stuff for consumers like it’s happening now (eg. now we’re relying on TS, who knows what is coming next, same for SASS).
As long as we use SASS, you’re free to build from the source but not from the distributed package.
There is a lot of stuff not even covered by the SASS variable so you’ll end up using CSS anyway with more important customizations. You can also notice from the CSS theming example that updating simple stuff like a color palette is not that different from variables as those are purely atomic class utilities. If there are other atomic classes that could be helpful, I’ll be happy to add them… and I’ll be definitely open to introducing CSS custom properties.
I published a new release with
src/styles
folder as a temporary patch but removed already the old recommendation of using SASS for theming. So I highly suggest avoiding relying on SASS variables as soon as you can as I’m planning to remove them again in the nextv0.22.*
release. If anybody wants to improve this part with more utility classes or CSS variables, PRs are always welcome.Huge thanks to @quentin-bettoum for his PR https://github.com/GrapesJS/grapesjs/pull/5437
Thanks for your answer and for the release.
At some point, I will take a look at what I can do regarding CSS variables.
AFAIK, many packages seem to include the sources when published with NPM.
In the case of styles, the purpose of SASS default values is precisely to be able to customize the library’s styles. I think that requiring to override every occurrence of a property in the CSS means that GrapesJS becomes as easy to theme as any other web app that don’t use SCSS or CSS variables.
I hope you will reconsider including the SCSS files in the package or, if you plan to change from SASS to something else as suggested above, to add CSS variables. Otherwise, the least annoying solution I’ll have in my case might be to manually copy the SCSS files and update them after each upgrade of GrapesJS. This is inconvenient, but still easier to maintain than CSS overrides, in my opinion.