gravitystorm / openstreetmap-website

The Rails application powering OpenStreetMap
http://www.openstreetmap.org/
GNU General Public License v2.0
2 stars 1 forks source link

What to do about bootstrap 5.2 #268

Closed gravitystorm closed 11 months ago

gravitystorm commented 1 year ago

See https://github.com/sass/sassc-rails/issues/174 and in particular my comment at https://github.com/sass/sassc-rails/issues/174#issuecomment-1226010642

So originally sass was a ruby project, then it became a C++ "libsass" which was available as sassc. Now the official implementation is in Dart.

This is a list of related ruby gems, there's a lot here:

The problem is that the bootstrap gem depends directly on sassc-rails, which makes it impossible to use dartsass-sprockets since they reuse the same namespace when both are loaded at the same time.

Option 1

Pin sassc gem to an old version, from before April 2019 when the error message was implemented in libsass.

Option 2

Use the sassc-embedded shim. This involves running a modified version of sassc that disables half the stuff, plus the sassc-embedded shim to make that stuff work via dart.

Option 3

Use dartsass-sprockets.

Option 4

Rename our css files to scss. This means that sprockets can do the stylesheets in one pass, which saves libsass from trying to read the minified version that is triggering this error.

Followups

gravitystorm commented 1 year ago

Final two points aren't relevant - bootstrap uses a custom division function that works with libsass, effectively "reverse polyfilling" support from the new dart version back to the old version.

The deprecation warnings come from our own code, which uses / in several places.

gravitystorm commented 1 year ago

I thought we'd solved this by switching around our includes, but it still triggers in precompilation. Latest review of options:

Option 2.1

Option 3.1

Option 4.1

See if we can refactor further, so that all the stylesheets are handled in one pass, e.g. including leaflet and iD via sass @import instead of via sprockets stuff

Option 5

See if we can persuade sassc-rails to become a wrapper for dartsass-sprockets

Option 6

Figure out what alternatives there are for using bootstrap, e.g. not from a gem, to allow us to switch to dartsass-sprockets

Option 7

Figure out whether to drop sprockets and move to whatever CSS option is the default approach in rails.

gravitystorm commented 1 year ago

Option 3.1 has happened!

So now we need to do some forking of the gem, since I doubt it would be backported to existing releases. We'll need to start with a 5.1 fork that has the dependency removed, start using that with dartsass, and then do the same again for 5.2

gravitystorm commented 11 months ago

https://github.com/openstreetmap/openstreetmap-website/pull/4261