After installing the cssbundling-rails gem I'm having trouble referencing my existing .scss files that live under app/assets/stylesheets/.
When you install the cssbundling-rails gem it:
- removes your
application.css(https://github.com/rails/cssbundling-rails/blob/main/lib/install/install.rb#L13) which contains all the references (*= require_tree .*= require_self) to then be used in the asset pipeline. - Replaces it with
application.tailwind.css(I ran the tailwind install) - Creates a new folder called
buildsthat containsapplication.csswith all tailwind css I use.
The result of 3 is then used <%= stylesheet_link_tag 'application' %> tag in the application layout as normal.
To reproduce:
- Create a new rails
Rails 6.1.4.1app rails g scaffold post- add some styles in
post.scssand verify styles are applied - install
cssbundling-rails - Install tailwind option
- restart server using
./bin/devand you'll see the styles not getting picked up.
A couple things I've tried.
- Referencing the stylesheet directly in
assets/config/manifest.js - Adding an import rule in the
application.tailwind.cssto reference existingscssfiles. - Adding the css directly to
application.tailwind.cssfile. This does work and the styles are correctly applied. I'm sure this is not the intended pattern.
Where and how can I reference exiting .scss under app/assets/stylesheets to be used in the new bundling/build process?
Admittedly, I think this stems from not fully understanding sprockets, asset pipeline, and bundling/build processes. I feel like I'm missing something obvious here.