sassc-rails
sassc-rails copied to clipboard
Glob Imports Not Working (Workaround Found)
I am in the process of upgrading an older Ruby / Rails application to the latest dependencies. When I swapped out sass-rails 5.1.0
to sassc-rails 2.1.2
, I encountered a really strange bug. I found a workaround but I figure this could help someone else
Also, I'm not entirely sure if the bug is on Rails (6.0.3.4)
or Sprockets (4.0.2)
or SassC-Rails (2.1.2)
or if I missed some documentation somewhere, but here is a simplified setup describing the issue:
Folder structure for /app/assets/stylesheets/
:
- admin.js.erb <-- (this is precompiled in manifest.js)
- admin/
- _main.scss
- _menu.scss
Contents of admin.js.erb
:
@import "admin/*";
Include statement in admin.html.erb
:
<%= stylesheet_link_tag "admin" %>
This usage of the glob import will cause the following error:
In order to fix this, I have to either import everything in the admin
folder one by one ... or change my stylesheet link call to this:
<%= stylesheet_link_tag asset_path("admin.css") %>