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

Pass options to the custom importer #83

Closed
strarsis opened this issue Nov 15, 2015 · 2 comments · Fixed by #89
Closed

Pass options to the custom importer #83

strarsis opened this issue Nov 15, 2015 · 2 comments · Fixed by #89
Labels
Milestone

Comments

@strarsis
Copy link
Contributor

strarsis commented Nov 15, 2015

As separate issue from #42 (comment)

I try to use this custom importer with eyeglass: https:/at-import/node-sass-import-once

[...]
  var eyeglass = new Eyeglass({
    importer: importOnce,
    importOnce: {
      index: true,
      css:   false,
      bower: false
    }
  });
[...]

However, the importer isn't able to see the importOnce property in options object,
is there a way to pass it to the custom importer when eyeglass is used instead of plain node-sass?

/home/build/src/test/node_modules/node-sass-import-once/index.js:275
  if (!this.options.importOnce) {
                   ^

TypeError: Cannot read property 'importOnce' of undefined
    at Object.importer [as fallbackImporter] (/home/build/src/test/node_modules/node-sass-import-once/index.js:275:20)
[...]
@eoneill
Copy link
Contributor

eoneill commented Nov 15, 2015

Thanks for reporting. The issue is that we manually invoke the importers, but we don't bind it to the context (this) that node-sass is invoking them with. I have a test case and fix I'll PR once #72 is merged.

@strarsis
Copy link
Contributor Author

strarsis commented Nov 16, 2015

See the referenced issue for a workaround that involves a wrapper that is bound.

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

Successfully merging a pull request may close this issue.

3 participants