Experimenting with Rails 7, but I’m little confused by something. I’m trying to start a project with importmap and sass.
rails new testproj
… uses the default of importmap (but without sass).
rails new testproj --css sass
… no longer uses the importmap default, and switches to esbuild.
rails new testproj --css sass --javascript importmap
… ignores the option flag and still uses esbuild.
rails new testproject
gem 'cssbundling-rails'
bundle install
rails css:install:sass
… appears to get me importmap and sass, but I’m confused why I’d have to go through all the extra steps. Is there some (good) reason that Rails is switching to esbuild in the previous examples?
Thanks. I suppose what I’m confused by is this: does the sass requirement to be compiled (via the script ‘build:css’) mean that there is no way to accomplish the same thing via importmaps? Because that’s what it seems Rails is telling me by automatically switching to esbuild when I choose sass.
The SASS is compiled during the development/deployment with a watcher set in package.json.
We could imagine an architecture where the runtime JavaScript libraries are handled by importmap and some dev libraries used by the developer could be handled by node/npm/yarn/package.json.
Install dart-sass (Sass: Install Sass). If you are on a Mac, you can install dart-sass with homebrew (brew install sass/sass/sass). See: Sass: Install Sass
You will need to add the foreman gem manually and configure a Procfile_dev. In the Procfile_dev, you can call dart-sass with the --watch option.
Bulma uses SASS to compile scss files and create a compiled .css. This is done each time you save a file and when you deploy the application.
The incompatibility comes from the SASS implementation. The SASS compiler is found in the node_module directory. That means that you should find a file named package.json with SASS and Bulma listed.