Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glob Imports Not Working (Workaround Found) #154

Open
D40298008 opened this issue Oct 16, 2020 · 0 comments
Open

Glob Imports Not Working (Workaround Found) #154

D40298008 opened this issue Oct 16, 2020 · 0 comments

Comments

@D40298008
Copy link

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") %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant