Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,26 @@ module.exports = function (content) {
// output compressed by default
opt.outputStyle = opt.outputStyle || 'compressed';
opt.stats = {};

// mark dependencies
var graph = sassGraph.parseFile(this.resourcePath, {loadPaths: opt.includePaths});
graph.visitDescendents(this.resourcePath, function (imp) {
this.addDependency(imp);
}.bind(this));

var loadPaths = opt.includePaths;
var markDependencies = function () {
try {
var graph = sassGraph.parseFile(this.resourcePath, {loadPaths: loadPaths});
graph.visitDescendents(this.resourcePath, function (imp) {
this.addDependency(imp);
}.bind(this));
} catch(err) {
this.emitError(err);
}
}.bind(this);

opt.success = function (css) {
markDependencies();
callback(null, css);
}.bind(this);

opt.error = function (err) {
markDependencies();
this.emitError(err);
callback(err);
}.bind(this);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dependencies": {
"loader-utils": "~0.2.2",
"node-sass": "^1.2.2",
"sass-graph": "^0.1.2"
"sass-graph": "git+https://github.com/lox/sass-graph.git#3a17328"
},
"devDependencies": {
"mocha": "^2.0.1",
Expand Down
3 changes: 3 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@ describe('sass-loader', function () {
test('should pass the include paths to node-sass', 'include-paths',
'includePaths[]=' + path.resolve(__dirname, './sass/another') + '&' +
'includePaths[]=' + path.resolve(__dirname, './scss/another'));

// Test for issue: https://github.com/jtangelder/sass-loader/issues/32
test('should pass with multiple imports', 'multiple-imports')
});
1 change: 1 addition & 0 deletions test/sass/multiple-imports.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "language", "another/module"
1 change: 1 addition & 0 deletions test/scss/multiple-imports.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "language", "another/module";