Commit b66931c3 by Arian Stolwijk

Fix --include-path option. (typo instead of --include-paths).

The option should be --include-path. You can have multiple
--include-path options though. Add a test where this is the case.
parent d4d397a1
...@@ -81,8 +81,8 @@ exports = module.exports = function(args) { ...@@ -81,8 +81,8 @@ exports = module.exports = function(args) {
outFile = options.outFile = path.join(cwd, path.basename(inFile, '.scss') + '.css'); outFile = options.outFile = path.join(cwd, path.basename(inFile, '.scss') + '.css');
} }
// make sure it's an array // make sure it's an array.
options.includePaths = argv['include-paths']; options.includePaths = argv['include-path'];
if (!Array.isArray(options.includePaths)) { if (!Array.isArray(options.includePaths)) {
options.includePaths = [options.includePaths]; options.includePaths = [options.includePaths];
} }
...@@ -104,11 +104,11 @@ exports = module.exports = function(args) { ...@@ -104,11 +104,11 @@ exports = module.exports = function(args) {
var watchDir = argv.w; var watchDir = argv.w;
if (watchDir === true) { if (watchDir === true) {
watchDir = [] watchDir = [];
} else if (!Array.isArray(watchDir)) { } else if (!Array.isArray(watchDir)) {
watchDir = [watchDir]; watchDir = [watchDir];
} }
watchDir.push(inFile) watchDir.push(inFile);
var throttledRender = throttle(render, options, emitter); var throttledRender = throttle(render, options, emitter);
......
...@@ -60,11 +60,15 @@ describe('cli', function() { ...@@ -60,11 +60,15 @@ describe('cli', function() {
}); });
}); });
it('should compile with --include-paths option', function(done){ it('should compile with --include-path option', function(done){
var emitter = cli(['--include-paths', __dirname + '/lib', __dirname + '/include_path.scss']); var emitter = cli([
'--include-path', __dirname + '/lib',
'--include-path', __dirname + '/functions',
__dirname + '/include_path.scss'
]);
emitter.on('error', done); emitter.on('error', done);
emitter.on('render', function(css){ emitter.on('render', function(css){
assert.equal(css.trim(), 'body {\n background: red; }'); assert.equal(css.trim(), 'body {\n background: red;\n color: blue; }');
fs.unlink(process.cwd() + '/include_path.css', done); fs.unlink(process.cwd() + '/include_path.css', done);
}); });
}); });
......
@function colorBlue() {
@return #0000FF;
}
@import "vars"; @import "vars";
@import "colorBlue";
body { background: $color; } body { background: $color; color: colorBlue(); }
\ No newline at end of file
...@@ -109,9 +109,9 @@ describe("compile file with include paths", function(){ ...@@ -109,9 +109,9 @@ describe("compile file with include paths", function(){
it("should compile with render", function(done) { it("should compile with render", function(done) {
sass.render({ sass.render({
file: path.resolve(__dirname, "include_path.scss"), file: path.resolve(__dirname, "include_path.scss"),
includePaths: [path.resolve(__dirname, "lib")], includePaths: [path.resolve(__dirname, "lib"), path.resolve(__dirname, "functions")],
success: function (css) { success: function (css) {
done(assert.equal(css, "body {\n background: red; }\n")); done(assert.equal(css, "body {\n background: red;\n color: blue; }\n"));
}, },
error: function (error) { error: function (error) {
done(error); done(error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment