Comments (7)
Looks like Propshaft compatibility will become relevant with the release of Rails 8 this year.
from camaleon-cms.
Definitely no webpacker. It never had a good story for engine assets, and now that it's deprecated there's no need to support it.
It sounds like we can more or less count on any Rails app having either Sprockets or Propshaft. My understanding of Propshaft is that it's like Sprockets but with fewer features, so is it the case that if we target Propshaft then things should continue to work with Sprockets as well?
The bundling gems work by feeding the output of the bundlers into Sprockets/Propshaft, so if our assets are available to Sprockets/Propshaft directly then the bundlers themselves are irrelevant to us. I think this is more or less the case for import maps as well, though we should definitely test that. For this reason, I do not think we need a separate NodeJS package. Please let me know if I'm missing something here.
Overall, it seems like we just need to make sure that Camaleon works with Propshaft. It looks like that means converting SASS to CSS and CoffeeScript to JS. I've actually tried to do this before to remove the sass-rails dependency, but something always gets the better of me. I would LOVE it if we could eliminate these dependencies. I see this as an opportunity to make our assets simpler, rather than more cumbersome.
The process I would propose:
- Make a new branch for experimental Propshaft support.
- Remove the sprockets-rails dependency.
- Migrate all CoffeeScript to JS and remove the coffee-rails dependency.
- Migrate all SASS to CSS and remove the sass-rails dependency.
- Add some Propshaft builds to Github Actions.
- If all goes well, merge the branch and release a v3 with the changes.
Do you see any problems with this approach?
from camaleon-cms.
Not quite so.
The jssbundling-rails
is feeding the JS assets to either Webpack, or Rollup, or Esbuild.
"Use esbuild, rollup.js, or Webpack to bundle your JavaScript, then deliver it via the asset pipeline in Rails"
The reason for having a JS package is that we don't use only ES modules JS and because of this we couldn't use importmaps
yet - see DHH's comment on the issue of building JS assets from engines
Esbuild is known to having some issues, and from Webpack and Rollup I'd choose Webpack as Rollup is supporting only ES modules and is less universal.
As for SASS vs CSS, SASS has become a standard - see dartsass
. And dartsass
is supported by the cssbundling-rails
and propshaft
- see rails/propshaft#92.
So one thing which certainly must be done first is:
- Migrate all CoffeeScript to JS and remove the coffee-rails dependency.
- Test thoroughly and craft a new minor release.
Then we have 2 choices to think on first:
- either upgrade all the JS dependencies one by one to modern versions having ES modules and then migrate to
importmaps
- or craft a JS package and start using
jsbundling-rails
with Webpack, and then start upgrading the JS dependencies one by one
The second option is tougher to implement, but it seems to give more flexibility on the JS upgrade path to ES modules. It could be a long way - upgrading all the JS to ES modules.
Not quite sure when the Sprockets to Propshaft + dartsass
migration should occur - seems that it could be tried any time.
from camaleon-cms.
BTW, jQuery isn't yet ESM compatible - they are planning it only for the upcoming 4.0 release. See jquery/jquery#4592
from camaleon-cms.
Thinking about this some more, I think that we need to build assets at release time instead of relying on the end user's build path.
For example:
# gemspec
s.add_development_dependency 'jsbundling-rails'
s.add_development_dependency 'cssbundling-rails'
# bin/build_release
#!/usr/bin/env ruby
system "some command to clear /specified/asset/directory"
# these commands would build in /specified/asset/directory
system "yarn build"
system "yarn build:css"
system "gem build" # gem will be built with the bundled asset files
That way, we can choose whatever build pipeline we want, and we don't have to support the complications of the end user's build pipeline or require them to use anything specific. We just have to leave the pre-built undigested files where Propshaft can find them (because if Propshaft can find them, so can Sprockets). If handled carefully, this might not even result in a breaking change.
Thoughts?
from camaleon-cms.
I am more and more inclined to the upgrade all the JS dependencies one by one to modern versions having ES modules and then migrate to importmaps
way.
from camaleon-cms.
That would be ideal, but I thought some of the dependencies don't have ESM compatible versions. I'd love to be mistaken about that, though.
from camaleon-cms.
Related Issues (20)
- Add SECURITY.md HOT 5
- Breaking change: Use a POST request to log out
- Glyphicons in admin panel HOT 12
- The Camaleon website is gone HOT 2
- Image auto crop broken HOT 1
- How can I check if user is logged from my own controller ? HOT 1
- CMS v3 HOT 8
- Adding ESlint broke TinyMCE HOT 1
- RuboCop HOT 4
- Exception after update version 2.6.3 to 2.7.2 -> NoMethodError in CamaleonCms::Admin#dashboard HOT 5
- Are emails broken? HOT 4
- tinymce-rails 6 support HOT 1
- Request to Check Email Regarding Security Advisory HOT 5
- Menu selection not working HOT 2
- XSS
- Xss
- XSS HOT 1
- XSS in post title HOT 1
- Image Compression Issue in Camaleon CMS 2.5.3.1 – Seeking Guidance HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camaleon-cms.