From b66931c34ae52f740b1dc803d237dead5711b86a Mon Sep 17 00:00:00 2001 From: Arian Stolwijk Date: Tue, 10 Sep 2013 16:06:30 +0200 Subject: [PATCH] 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. --- lib/cli.js | 8 ++++---- test/cli.js | 10 +++++++--- test/functions/colorBlue.scss | 3 +++ test/include_path.scss | 3 ++- test/test.js | 4 ++-- 5 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 test/functions/colorBlue.scss diff --git a/lib/cli.js b/lib/cli.js index e85ee8fdd..63ced2a77 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -81,8 +81,8 @@ exports = module.exports = function(args) { outFile = options.outFile = path.join(cwd, path.basename(inFile, '.scss') + '.css'); } - // make sure it's an array - options.includePaths = argv['include-paths']; + // make sure it's an array. + options.includePaths = argv['include-path']; if (!Array.isArray(options.includePaths)) { options.includePaths = [options.includePaths]; } @@ -104,11 +104,11 @@ exports = module.exports = function(args) { var watchDir = argv.w; if (watchDir === true) { - watchDir = [] + watchDir = []; } else if (!Array.isArray(watchDir)) { watchDir = [watchDir]; } - watchDir.push(inFile) + watchDir.push(inFile); var throttledRender = throttle(render, options, emitter); diff --git a/test/cli.js b/test/cli.js index 0f33a7da2..9432ae362 100644 --- a/test/cli.js +++ b/test/cli.js @@ -60,11 +60,15 @@ describe('cli', function() { }); }); - it('should compile with --include-paths option', function(done){ - var emitter = cli(['--include-paths', __dirname + '/lib', __dirname + '/include_path.scss']); + it('should compile with --include-path option', function(done){ + var emitter = cli([ + '--include-path', __dirname + '/lib', + '--include-path', __dirname + '/functions', + __dirname + '/include_path.scss' + ]); emitter.on('error', done); 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); }); }); diff --git a/test/functions/colorBlue.scss b/test/functions/colorBlue.scss new file mode 100644 index 000000000..816fbbc40 --- /dev/null +++ b/test/functions/colorBlue.scss @@ -0,0 +1,3 @@ +@function colorBlue() { + @return #0000FF; +} diff --git a/test/include_path.scss b/test/include_path.scss index 892080291..8ee2b7fec 100644 --- a/test/include_path.scss +++ b/test/include_path.scss @@ -1,3 +1,4 @@ @import "vars"; +@import "colorBlue"; -body { background: $color; } \ No newline at end of file +body { background: $color; color: colorBlue(); } diff --git a/test/test.js b/test/test.js index b6d22f8d7..380c2e57f 100644 --- a/test/test.js +++ b/test/test.js @@ -109,9 +109,9 @@ describe("compile file with include paths", function(){ it("should compile with render", function(done) { sass.render({ file: path.resolve(__dirname, "include_path.scss"), - includePaths: [path.resolve(__dirname, "lib")], + includePaths: [path.resolve(__dirname, "lib"), path.resolve(__dirname, "functions")], 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) { done(error);