Skip to content

Commit 45ea535

Browse files
committed
Add implementation of dependency tree
1 parent afbe22d commit 45ea535

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

bin/lessc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ var ensureDirectory = function (filepath) {
163163
};
164164

165165
if (options.depends) {
166-
// output the target filename, needs to be specified on the command line (no stdout)
166+
if (!outputbase) {
167+
sys.print("option --depends requires an output path to be specified");
168+
return;
169+
}
167170
sys.print(outputbase + ": ");
168171
}
169172

@@ -184,8 +187,10 @@ var parseLessFile = function (e, data) {
184187
currentErrorcode = 1;
185188
return;
186189
} else if (options.depends) {
187-
// todo - loop through the imports
188-
// sys.print(path.resolve(path.dirname(env.parentPath),importname)
190+
for(var file in parser.imports.files) {
191+
sys.print(file + " ")
192+
}
193+
sys.print("\n");
189194
} else if(!options.lint) {
190195
try {
191196
var css = tree.toCSS({

lib/less/lessc_helper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var lessc_helper = {
3030
sys.puts("options:");
3131
sys.puts(" -h, --help Print help (this message) and exit.");
3232
sys.puts(" --include-path Set include paths. Separated by `:'. Use `;' on Windows.");
33+
sys.puts(" -M, --depends Output a makefile import dependency list to stdout");
3334
sys.puts(" --no-color Disable colorized output.");
3435
sys.puts(" --no-ie-compat Disable IE compatibility checks.");
3536
sys.puts(" -l, --lint Syntax check only (lint).");

0 commit comments

Comments
 (0)