twbs / bootstrap-sass

Official Sass port of Bootstrap 2 and 3.
http://getbootstrap.com/css/#sass
MIT License
12.58k stars 3.53k forks source link

Possible to use this gem with `dartsass-rails`? #1247

Open nimmolo opened 6 months ago

nimmolo commented 6 months ago

Switching our Rails 7 app from sassc to dartsass-sprockets works with bootstrap-rails.

But if we try to switch to dartsass-rails, assets:precompile fails.

If we keep gem sprockets-rails and sprockets:railtie:

LoadError: cannot load such file -- sass (LoadError)

or if we don't load sprockets, of course there's no task assets:precompile:

Don't know how to build task 'assets:precompile' (See the list of available tasks with `rake --tasks`)

I've tried debugging this according to this issue on dartsass-rails, but even with the file app/assets/builds/.keep in place, assets:precompile is not a defined task.

Reading through the code of this gem, it seems that sprockets-rails is not a dependency. Is there anyone who has gotten this to work with dartsass-rails?

mhenrixon commented 3 months ago

Try dartsass-sprockets instead. I use that quite successfully as it uses sass-embedded under the hood.

nimmolo commented 3 months ago

Thanks @mhenrixon - dartsass-sprockets is what we're using now. Are you able to get it to compile changes to your SASS?

Unfortunately for us, dartsass-sprockets has started ignoring dev changes in any SASS files that are included by @import. It does not compile the changes unless we force it by changing some variable in top level SASS files. I don't know if our issue is with sass-embedded, dartsass-sprockets... or if it's expected behavior, because the older version of Bootstrap included with this gem now throws SASS deprecation warnings.

That's why we were looking to try dartsass-rails. In any case I believe that we'll update to BS 4 and 5 pretty soon, and then we'll switch to the appropriate gem for those versions, or maybe include the SCSS manually. But in the meantime it's making front end changes much more complicated.

mhenrixon commented 3 months ago

That's why we were looking to try dartsass-rails. In any case I believe that we'll update to BS 4 and 5 pretty soon, and then we'll switch to the appropriate gem for those versions, or maybe include the SCSS manually. But in the meantime it's making front end changes much more complicated.

@nimmolo, I have already upgraded one project to BS 5.3, but the other project is a beast of 300,000 LoC and has 60% test coverage.

esbuild/node-sass still have issues with picking up on changes that I haven't experienced with, say, tailwindcss, vite, and bun.

nimmolo commented 3 months ago

@mhenrixon Good to know about node-sass not picking up changes either. Something tells me the deprecation warnings from BS 3 are stoping compilation and i just have to knuckle down and upgrade.

I agree with you about how daunting that can be. My main project is a 271K LoC beastie that i've been trying to get to BS4 for years, but keep realizing there are deeper things to fix!