-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use CSS and JS bundling for assets #413
Conversation
This was left over from a previous upgrade
This is now an optional dependency
This adds the following: - An app/assets/builds folder - This will contain built JS, which will then be served via the asset pipeline - Add app/javascript/application.js file - This is the entrypoint for all frontend Javascript - A bin/dev file - This should be how to run the application in development. It runs (and optionally installs) Foreman, to run the server and build Javsacript on the fly - A Procfile.dev file - This tells Foreman what processes to run when running the bin/dev script - A rollup.config.js file - This tells Rollup how to build the Javascript in the application.js
This has required us to install Yarn in the base layer, so we can run yarn in the main layer and watch the JS for changes
This allows us to support older browsers (down to and including IE11)
This allows us to `import` separate JS components and have them all run when the JS is invoked (i.e. on pageload)
As well as gems that we no longer use
Turbolinks is deprecated now, so let’s use [Turbo](https://github.com/hotwired/turbo) instead
This does the following: - Installs the `sass` node library - Adds a `build:css` command to build css via node - Adds the `build:css` command to the Procfile - Removes the `stylesheets` dir from manifest.js
7a7f7e3
to
e2f0967
Compare
I don't have a strong opinion yet but I think we should talk about the choice of Rollup over importmaps, as I think it is a choice? As I understand it importmaps don't require Seems like we can get packages like the govuk-frontend by using their "designed to be used with JavaScript CDNs for your npm package dependencies" with pinning. |
Given this PRs age and that the required #412 has been closed, I am going to close this as well. |
Webpacker is now no longer in active development, so I've added support for cssbundling-rails with sass and jsbundling-rails with Rollup.js.
Now asset dependencies (css / js libraries etc) are all handled by Yarn, and the building of assets is handled by Yarn scripts, rather than magically happening via the asset pipeline. This keeps concerns nicely seperated and gives us much more control over how assets are processed and built.
There is also a
bin/dev
file which watches assets for changes via Foreman when the server is spun up.This is draft until #412 is in.