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

import statements caveat #59

Closed
mgmorcos opened this issue Mar 11, 2015 · 6 comments
Closed

import statements caveat #59

mgmorcos opened this issue Mar 11, 2015 · 6 comments

Comments

@mgmorcos
Copy link

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

@mgmorcos mgmorcos changed the title import statement resolution caveat import statements caveat Mar 11, 2015
@jhnns
Copy link
Member

jhnns commented Mar 11, 2015

#31

@jhnns jhnns closed this as completed Mar 11, 2015
@mikeyamadeo
Copy link

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!

@jhnns
Copy link
Member

jhnns commented Mar 12, 2015

Just wanted to confirm my understanding after reading through the issues that a solution to this is still being worked on?

Yes

@grrowl
Copy link

grrowl commented Mar 16, 2015

@mikeyamadeo until sass-loader gets whatever resolution features they need from libsass, you'll have to do like this:

webpack.config.js:

      {
        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
        ]
      }

app.scss:

// 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 '&includePaths[]='+ path.resolve(__dirname, 'bower_components', 'bootstrap-sass', 'assets', 'stylesheets')

@grrowl
Copy link

grrowl commented Mar 16, 2015

but note your webpack resolve.alias settings won't never be taken into consideration for sass @imports, until #53

@mikeyamadeo
Copy link

@grrowl Thank You! I appreciate you taking the time to help me out on this. This does just the trick.

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

4 participants