Skip to content

Glob Imports Not Working (Workaround Found) #154

Open
@D40298008

Description

@D40298008

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions