[openstreetmap/openstreetmap-website] Switch to dartsass-sprockets for stylesheets (PR #4260)
Andy Allan
notifications at github.com
Wed Sep 27 09:26:59 UTC 2023
[`sassc-rails`](https://github.com/sass/sassc-rails) and the underlying C-library [libsass](https://github.com/sass/libsass), are deprecated. `libsass` has problems when compiling newer versions of Bootstrap (5.2+), where it cannot re-parse its own output, and that causes problems during our asset precompilation. After extensive investigations I cannot find a workaround to keep using sassc-rails with newer versions of Bootstrap.
This PR switches our sass stylesheet compiler to [`dartsass-sprockets`](https://github.com/tablecheck/dartsass-sprockets), which is designed to be a drop-in replacement for `sassc-rails`, and which uses the currently maintained [dart implementation of sass](https://sass-lang.com/dart-sass/).
Unfortunately the bootstrap gem had, [until recently](https://github.com/twbs/bootstrap-rubygem/commit/fde1edff90d9219bbef48ecc6a65f13835269bcd), a hard-coded dependency on `sassc-rails`, and therefore conflicted with `dartsass-sprockets` (the two cannot be used at the same time). Although this has been resolved in bootstrap-rubygems main branch, the fix has not been backported to the 5.1 and 5.2 branches. To work around this, I have backported the fix myself, and this PR uses the bootstrap 5.1 backported version.
I have also prepared two other branches, which I will open draft PRs for, namely:
* Upgrading to bootstrap 5.2, with the appropriate backport
* Upgrading to bootstrap 5.3, using bootstrap-rubygem main branch (backport no longer required)
I'm offering these as a series of incremental upgrades, with all the associated backporting hassle, just in case there are any problems with deployment that CI hasn't picked up, as well as to make them easier to review.
A note on `sass-embedded` pinning - in recent years dartsass has added a number of deprecation warnings relating to changes in the sass language. Bootstrap quickly receives fixes to deal with them, but these fixes are generally not backported to earlier releases. To avoid copious noise from these deprecations, it's best to use a version of dartsass that is contemporary with each bootstrap release. Each PR in this series does so. When we update to 5.3+ this will be less of an issue.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/4260
-- Commit Summary --
* Install git in Docker to allow git repos in Gemfile
* Switch from sassc-rails to dartsass-sprockets
* Workaround for dartsass vs bootstrap 5.1 bug
-- File Changes --
M Dockerfile (1)
M Gemfile (6)
M Gemfile.lock (40)
M app/assets/stylesheets/parameters.scss (10)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/4260.patch
https://github.com/openstreetmap/openstreetmap-website/pull/4260.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4260
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4260 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230927/0add2034/attachment-0001.htm>
More information about the rails-dev
mailing list