sass / sassc-rails

Integrate SassC-Ruby with Rails!
MIT License
707 stars 104 forks source link

Glob Imports Not Working (Workaround Found) #154

Open D40298008 opened 4 years ago

D40298008 commented 4 years ago

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:

Screen Shot 2020-10-16 at 12 56 37 PM

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") %>