Skip to content
New issue

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

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

Already on GitHub? # to your account

Support for globbed imports? #151

Closed
Lordnibbler opened this issue Aug 18, 2015 · 3 comments
Closed

Support for globbed imports? #151

Lordnibbler opened this issue Aug 18, 2015 · 3 comments

Comments

@Lordnibbler
Copy link

Maybe this is just unclear in the instructions, but it seems that sass-loader does not support globbed imports, like `@import “pages/*/”? i keep seeing the error:

22:33:06 hot.1    | Module build failed:
22:33:06 hot.1    | @import "../refills/**/*";
22:33:06 hot.1    |        ^
22:33:06 hot.1    |       File to import not found or unreadable: ../refills/**/*/Users/nibbler/Code/github/railsblog/app/assets/stylesheets/base/
@Lordnibbler
Copy link
Author

Ah, after a little more digging I found this: https://github.com/Aintaer/import-glob-loader

Seems to work nicely but only for globbed imports that are relative to current path, ie. @import "foo/**/*" works fine, but @import "../foo/**/*" does not.

@jezstephens
Copy link

import-glob-loader seems to have a couple of drawbacks.

  • It screws up the line numbers in Webpack's error messages by inserting additional lines into the input.
  • When used with no file extension it includes all files, so if you have Sass files mixed with other non-CSS files it's necessary to say foo/**/*.scss. This could be argued as a good thing, but I think it'd be more intuitive if foo/**/* was equivalent to foo/**/*.scss.

So perhaps sass-loader could support Sass-specific globbing a bit better than import-glob-loader.

I found that "../foo/*/" worked with import-glob-loader, by the way.

@jhnns
Copy link
Member

jhnns commented Oct 23, 2015

@jezstephens

It screws up the line numbers in Webpack's error messages by inserting additional lines into the input.

This should be reported to the import-glob-loader

When used with no file extension it includes all files, so if you have Sass files mixed with other non-CSS files it's necessary to say foo//*.scss. This could be argued as a good thing, but I think it'd be more intuitive if foo//* was equivalent to foo/*/.scss

Yes, I think, it is a good thing to add the file extension explicitly.

So perhaps sass-loader could support Sass-specific globbing a bit better than import-glob-loader.

I think the import-glob-loader is doing a pretty decent job here. I don't want to add this feature to the sass-loader because the import mechanism is already pretty complicated. Once we started to implement it here, we are responsible to maintain that feature.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants