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

Need resourcePath in custom importer #234

Closed
jameslnewell opened this issue Apr 16, 2016 · 3 comments · Fixed by #267
Closed

Need resourcePath in custom importer #234

jameslnewell opened this issue Apr 16, 2016 · 3 comments · Fixed by #267

Comments

@jameslnewell
Copy link

Because stdin is the value of prev in function (url, prev, done) my custom importer can't load files relative to the SCSS file @importing another SCSS file.

Could the importers be wrapped something like this?

sassOptions.importer = sassOptions.importer 
  ? [].concat(sassOptions.importer).map(function(importer) {
    return function(url, prev, done) {
      return importer(url, prev === 'stdin' ? resourcePath : prev, done); // <== replace 'stdin'
    };
  }
  : []
;
@jhnns
Copy link
Member

jhnns commented Jun 26, 2016

That looks like a good idea! Can you create a PR + a small test-case for it? Just mention me in my PR and I will merge it asap.

@neverfox
Copy link

neverfox commented Sep 7, 2016

I can't be sure, but I think this breaks this inside of the custom importer. I'm not sure if that's a problem that can or should be solved in the importer or not, but see here for context.

@jameslnewell
Copy link
Author

jameslnewell commented Sep 13, 2016

return importer.call(this, url, prev === 'stdin' ? resourcePath : prev, done); should fix that I think

EDIT: too late https://github.com/jtangelder/sass-loader/pull/277/files#diff-168726dbe96b3ce427e7fedce31bb0bcR412

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

Successfully merging a pull request may close this issue.

3 participants