Migrate to Webpacker (CSS and images)#7733
Conversation
… many exports references (in progress...)
…forces to use Decidim webpacker
…ontent Because of the name of the file was based in the hash, there are some SVGs that are duplicated (i.e decidim_proposals, decidim_elections) and those weren't generated by the first compilation of Webpack
|
@mrcasals @ahukkanen sorry for the delay, now the branch is updated and working again. I had a hard time figuring out why some of the SVGs weren't being compiled by Webpack, until I realized that the path for the compiled assets is [hash][extension], so when the hash is duplicated the file is not generated, and some of the Decidim logos use the same SVG, and thus those duplicated logos were missing, causing some tests to fail, of course. On the other side, I created the task decidim:webpacker:install which moves all the config necessary to run webpacker inside the rails app and works pretty well. Please take a look, I think it's ready to be reviewed. I also upgraded as we agreed the version of node, and updated some dependencies thanks to Once you confirm it's ok I'd like to udpate the PR description and the docs explaining a bit how it works and how can new JS dependencies be added to Decidim. |
|
It's super difficult to review, so I'll merge and pray everything's fine 😅 |
|
@ferblape for future reference, don't wait for me before adding documentation, you can write it in another PR and specify that it requires this PR in order to be merged 😄 |
|
PR updated with the links to the docs |
(This PR is built on top of #7464)
This PR migrates CSSs and images from the old and beloved Asset Pipeline to they young and modern Webpacker.
This PR uses a beta version of Webpacker 6 gem, which is almost ready to be released and uses the modern Webpack v5. At the time of creating this PR that version hasn't been released yet.
Development process
The development process is very smooth, in the root folder of Decidim the webpack-dev-server is available via
bin/webpack-dev-serverand the development_app is configured to use Decidim's Webpacker, so asset changes are detected and automatic reloading is enabled.Testing environment
Node has been added to all github workflows, together with a yarn install (using a cache folder to speedup) and it's necessary to precompile the assets before running the specs.
Documentation
Some documents have been added:
📌 Related Issues
Testing
You should create a new development_app, start webpack dev server and start browsing:
📋 Checklist
🚨 Please review the guidelines for contributing to this repository.
docs/.📷 Screenshots
Please add screenshots of the changes you're proposing
