-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
import statements caveat #59
Comments
Hi. I've just begun configuring with webpack and for the life of me hadn't be able to get imports to resolve w/ a combination of webpack aliasing and modulesDirectories using sass-loader. "File to import not found or unreadable" is my ever occurring error. Alas, I read the sass-loader caveat. Just wanted to confirm my understanding after reading through the issues that a solution to this is still being worked on? @jhnns Thanks! |
Yes |
@mikeyamadeo until sass-loader gets whatever resolution features they need from libsass, you'll have to do like this:
{
test: /\.s?css$/,
loaders: [
'css',
'sass?includePaths[]='+ path.resolve(__dirname, 'node_modules') +
'&includePaths[]='+ path.resolve(__dirname, 'bower_components')
// tells sass-loader to look in these dirs when resolving files
]
}
// These files are in the same directory as app.scss
@import "variables";
@import "breakpoints";
// These files are in the bower_components directory
@import "susy/sass/susy"; // resolves to bower_components/susy/sass/_susy.scss
@import "compass-breakpoint/stylesheets/breakpoint"; // resolves to bower_components/compass-breakpoint/stylesheets/breakpoint.scss If you use a lot of a library (such as pulling selective files from bootstrap), you could add that to your includePaths like |
but note your webpack |
@grrowl Thank You! I appreciate you taking the time to help me out on this. This does just the trick. |
sass/libsass#21 is resolved since 11/2014 but still cited as preventing
@import
statement resolution:https://github.com/jtangelder/sass-loader/blob/9e7caca80f8a0908289cdbdfe8a80ae5e7e1781e/README.md#caveats
The text was updated successfully, but these errors were encountered: