Commit ce372052 by Michael Mifsud

Merge pull request #1126 from dotzero/follow

Add --follow option to the CLI
parents 2b8a9862 41cf00d9
......@@ -496,6 +496,7 @@ Output will be saved with the same name as input Sass file into the current work
--source-map-embed Embed sourceMappingUrl as data URI
--source-map-root Base path, will be emitted in source-map as is
--include-path Path to look for imported files
--follow Follow symlinked directories
--precision The amount of precision allowed in decimal numbers
--importer Path to .js file containing custom importer
--functions Path to .js file containing custom functions
......
......@@ -46,6 +46,7 @@ var cli = meow({
' --source-map-embed Embed sourceMappingUrl as data URI',
' --source-map-root Base path, will be emitted in source-map as is',
' --include-path Path to look for imported files',
' --follow Follow symlinked directories',
' --precision The amount of precision allowed in decimal numbers',
' --importer Path to .js file containing custom importer',
' --functions Path to .js file containing custom functions',
......@@ -54,6 +55,7 @@ var cli = meow({
}, {
boolean: [
'indented-syntax',
'follow',
'omit-source-map-url',
'quiet',
'recursive',
......@@ -331,7 +333,7 @@ function renderFile(file, options, emitter) {
*/
function renderDir(options, emitter) {
var globPath = path.resolve(options.directory, globPattern(options));
glob(globPath, { ignore: '**/_*' }, function(err, files) {
glob(globPath, { ignore: '**/_*', follow: options.follow }, function(err, files) {
if (err) {
return emitter.emit('error', util.format('You do not have permission to access this path: %s.', err.path));
} else if (!files.length) {
......
......@@ -590,6 +590,32 @@ describe('cli', function() {
});
describe('node-sass --follow --output output-dir input-dir', function() {
it('should compile with the --follow option', function(done) {
var src = fixture('follow/input-dir');
var dest = fixture('follow/output-dir');
fs.mkdirSync(src);
fs.symlinkSync(path.join(path.dirname(src), 'foo'), path.join(src, 'foo'), 'dir');
var bin = spawn(cli, [src, '--follow', '--output', dest]);
bin.once('close', function() {
var expected = path.join(dest, 'foo/bar/index.css');
fs.unlinkSync(path.join(src, 'foo'));
fs.rmdirSync(src);
assert(fs.existsSync(expected));
fs.unlinkSync(expected);
expected = path.dirname(expected);
fs.rmdirSync(expected);
expected = path.dirname(expected);
fs.rmdirSync(expected);
fs.rmdirSync(dest);
done();
});
});
});
describe('importer', function() {
var dest = fixture('include-files/index.css');
var src = fixture('include-files/index.scss');
......
#navbar {
width: 80%;
height: 23px;
}
#navbar ul {
list-style-type: none;
}
#navbar li {
float: left;
a {
font-weight: bold;
}
}
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