Open nicoespeon opened 5 years ago
I created a new issue from the comment, so I can keep track of it 😉
If a file is passed in, the user is saying they only care about dependencies linked to that specified file.
Indeed, makes sense to me.
parseDir
globs the whole directory for files with matching extensions, so you can get two sets of graphs.
Thanks for the detailed explanation. Now I clearly understand the benefit of using parseFile
if given path is a single file.
I agree that could be a nice improvement, reducing noise and false positives.
If I get the time, maybe I can look into creating a PR.
That would be awesome. I'll take a stab at it at some point if you don't have time to do, but I'm currently working on another project.
Ideally, I'd love to have a showcase of the problem in the examples/
(with an associated command) so we can check the working behaviour—and essentially see the before/after effect, validating the use-case.
[…]
So
parseFile
documented in their API. The reason I suggest it is because the graph can be smaller if your sass/scss/less/css in your directory would have created a bipartite graph, or more generalized multipartite.parseDir
globs the whole directory for files with matching extensions, so you can get two sets of graphs. By adding less and css support, if you have a directory with both less and sass, you can get both a less and sass graph. Now, this might not be something you are worried about since less is not this project's focus. But sass can be affected too. For example, if you have files which aren't imported. I know you said:But, that can still work if you pass in a directory. If a file is passed in, the user is saying they only care about dependencies linked to that specified file. So passing in a file can guarantee a 1-partite graph, if that's the correct terminology.
sassgraph's CLI only uses
parseDir
but that is fine because they are only outputting text. Since you are drawing a graph, this is a useful optimization to provide the user. If I get the time, maybe I can look into creating a PR.Originally posted by @dosentmatter in https://github.com/nicoespeon/sass-graph-viz/issues/10#issuecomment-513335031