Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

[Enhancement] Passes import path to importer as option #136

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion lib/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ var variables = require('rework-vars');

exports.import = function(options){
return 'undefined' == typeof window && options.source
? importer()
? importer({
path: options.paths
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went to paths since path implies a string when it can handle an array of paths

})
: function(){};
};

Expand Down
4 changes: 3 additions & 1 deletion test/features/import.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

@import "import.include.css";

@import "paths-example/import.include.css";

body {
color: red;
}
}
6 changes: 5 additions & 1 deletion test/features/import.out.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ html {
color: black;
}

span {
color: black;
}

body {
color: red;
}
}
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('features', function(){

describe(slug, function(){
it('should add ' + slug + ' node support', function(){
var css = myth(input, { source: source });
var css = myth(input, { source: source, paths: [__dirname]});
assert.equal(css.trim(), expected.trim());
});

Expand Down
4 changes: 4 additions & 0 deletions test/paths-example/import.include.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

span {
color: black;
}