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

Support custom node-sass importer compileOption. #24

Closed
jgerigmeyer opened this issue Dec 7, 2017 · 0 comments
Closed

Support custom node-sass importer compileOption. #24

jgerigmeyer opened this issue Dec 7, 2017 · 0 comments

Comments

@jgerigmeyer
Copy link
Contributor

Right now, any custom importer fn is ignored (replaced by the sass-extract specific importer), and not passed through to node-sass. I see this issue has been mentioned in both sass-extract loader (jgranstrom/sass-extract-loader#1) and babel-plugin-sass-extract (jgranstrom/babel-plugin-sass-extract#1), but I don't see a fix for it yet.

For example, I have sass files that use webpack's ~ shortcut to import node modules:

@import '~my-module/sass/utility';

When not using webpack to compile, I pass a simple importer option through to node-sass:

importer: url => {
  if (url[0] === '~') {
    url = path.resolve('node_modules', url.substr(1));
  }
  return { file: url };
},

This doesn't work with sass-extract, however (see https://github.com/jgranstrom/sass-extract/blob/master/src/extract.js#L39).

I'll submit a PR shortly that fixes this.

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