Skip to content

Commit

Permalink
Allow node-sass importers to be passed in options.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmowrer committed Sep 30, 2015
1 parent 9333e6d commit d865bc1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,18 @@ module.exports = function (content) {
// indentedSyntax is a boolean flag
opt.indentedSyntax = Boolean(opt.indentedSyntax);

opt.importer = getWebpackImporter();
// `node-sass`'s importer takes an array of functions. Since `parseQuery` doesn't allow functions,
// `opt.importer` has to be a path or array of paths that, once `require`d, return importer functions.
opt.importer = []
.concat(opt.importer || [])
.map(function(path) {
return require(path);
})
.concat(getWebpackImporter());

// `node-sass` uses `includePaths` to resolve `@import` paths. Append the currently processed file.
opt.includePaths = (opt.includePaths || [])
.concat(path.dirname(resourcePath));

// start the actual rendering
if (isSync) {
Expand Down

0 comments on commit d865bc1

Please sign in to comment.