question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add command line switch to print dependencies

See original GitHub issue

There are situations, where one is interested only in dependencies for a specific Sass file, e.g., in Makefiles. It would be great, if Sass could provide such a list. For example:

// file foo.scss
@import "bar";

// file _bar.scss
@import "baz";

// file _baz.scss
// ...some Sass...

Then imagine this call and response:

$ sass --print-dependencies foo.scss
_bar.scss
_baz.scss

It would be great to have for auto-generating dependency files for your build tool of choice, e.g. GNU make:

$ echo "foo.scss: $(sass --print-dependencies foo.scss)" > foo.scss.mk

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chriseppsteincommented, Jun 20, 2013

Printing dependencies is not an aspect of compiling Sass files.

As demonstrated, it is an aspect of integrating with a build tool for compiling sass files. gcc provides this ability via the -M command line option. From the man page for gcc, the -M option: “Instead of outputting the result of preprocessing, output a rule suitable for make describing the dependencies of the main source file.”

Emitting the same output we normally do in a machine-readable format is different

Newline separated lists is a very machine readable format designed for use with numerous unix utilities. For example: sass --dependencies foo.scss | xargs vim and now I’ve opened every dependency of my file in my text editor. It also works great with grep.

You can even make a fair go at invoking it from the command line

That’s not a fair go at it. It doesn’t take import paths into account. It doesn’t take relative imports into account. Doing these things correctly is non-trivial.

The issue isn’t that sass shouldn’t integrate with other tools; it’s that listing dependencies is outside its purview.

The claim is that listing dependencies is a form of tool integration. A code example was provided by @codifferous showing this to be true. Simply stating that the purview of sass is one form of tool integration but not another is not founded in a rational basis. You have made a value judgement that one tool is more important to integrate with than another and that the first one is worth working on and the second one is not.

this is a narrower use-case than warrants the cost of adding a new option.

This is really the core of your argument. You simply don’t think it’s worth supporting make out of the box. I disagree. Make continues to be an important build tool and I don’t find the cost of having this option in the -h output onerous. But, to be fair, GCC doesn’t list the -M option in the --help output, it only mentions it in the man page.

It doesn’t make sense to add every option that would be useful to anyone.

Every option should be evaluated independently. I’ve certainly rejected many of them. No one has claimed that every option should be added, and using a slippery-slope argument is not productive.

0reactions
nex3commented, Apr 5, 2018

This is not planned.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dependency-check-cli – Command Line Arguments
Print the version information. Optional. --cveValidForHours, <hours>, The number of hours to wait before checking for new updates from the NVD. The default...
Read more >
Command Line Options and Return Values
Profiling option: Simulate ShellExecute by inserting any App Paths directories into the PATH environment variable - Use /ps:0 to start Dependency Walker with ......
Read more >
Devenv command line switches - Visual Studio - Microsoft Learn
Devenv lets you set various options for the IDE, build projects, debug projects, and deploy projects from the command line. Use these switches...
Read more >
How to add command line parameter dependency using ...
I am using JCommander for command line parameters parsing. I would like to add parameter dependency, but from the JCommander documentation, I am...
Read more >
Using Command-Line Arguments to Configure In-App ...
Using Command-Line Arguments to Configure In-App Dependencies ... CommandLine.arguments[valueIndex] print(greeting) } } else { print("Hello, world!") }.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found