Skip to content

Commit

Permalink
Allow relative paths in scoped packages
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeTaveras1231 committed Nov 20, 2016
1 parent 9e27c84 commit ec16eb2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ var findup = require('findup'),
var local = require('./local');

function find(dir, file, callback) {
var name;
var name, isScoped = false;
if (file.split('/')[0][0] === '@') {
name = file.split('/').slice(0, 2).join('/');
isScoped = true;
} else {
name = file.split('/')[0];
}
Expand Down Expand Up @@ -36,7 +37,11 @@ function find(dir, file, callback) {
}
// if a full path is provided
} else {
location = path.join('../', file);
if(isScoped) {
location = path.join('..', '..', file);
} else {
location = path.join('..', file);
}
}
callback(null, path.resolve(root, location));
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "@lennym/npm-sass-test-sass/child-file";
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "npm-sass-test-npm-modules",
"version": "0.0.0",
"description": "sass compilation with npm aware include paths",
"dependencies": {
"@lennym/npm-sass-test-sass": "0.0.0"
}
}

0 comments on commit ec16eb2

Please # to comment.