Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: input source file with --depends options #2476

Closed
fitnr opened this issue Feb 25, 2015 · 10 comments
Closed

feature request: input source file with --depends options #2476

fitnr opened this issue Feb 25, 2015 · 10 comments

Comments

@fitnr
Copy link

fitnr commented Feb 25, 2015

Right now, when one runs: lessc --depends source.less dest.css, the result is:

dest.css: (imports in source.less)

source.less is notably omitted from the list of prerequisites for dest.css. This means that make will not re-run the command if source.less is the only changed file. A better result would be

dest.css: source.less (imports in source.less)

I believe the only change required is on line 413 of bin/lessc and have a patch ready.

@lukeapage
Copy link
Member

lukeapage commented Feb 25, 2015 via email

@fitnr
Copy link
Author

fitnr commented Feb 25, 2015

Good idea. What do you think, @StefanWallin?

Another detail I just realized - running with the depends option still writes the file, which kind of defeats the purpose of using make. So I also suggest making lessc --depends a noop, except for echoing the make rule.

@StefanWallin
Copy link
Contributor

I've long since left the company where we used this and as such, I have not personally used this feature or Make in about 2.5 years. I think we have a reason that made me not want the sourcefile being included in the list of dependencies.

Logically speaking, the source file is not a dependency of it self. I'm trying to get a hold of the people that have the code using this part of lessc.

On the other hand, during these 3 years since implementation I'd say that people have probably used this feature and gotten around this issue and that this might be incorporating a breaking change for those people.

@StefanWallin
Copy link
Contributor

My old coworker just left the office, he will check on the issue tomorrow.

@fitnr
Copy link
Author

fitnr commented Feb 25, 2015

I agree that this isn't worth introducing a breaking change if this is an important feature.

What you say about source not being a dependency of itself makes me think that it would actually make the most sense if the command output something like this:

$ lessc --depends source.less

source.less: foo.less bar.less

Maybe that could be the output of dest.css is omitted.

@StefanWallin
Copy link
Contributor

If you would like to implement this new feature, you might be better off trying to replicate the behaviour of gcc, with it's flags of -M, -MM, -MF, -MD, -MMD & -MG as appropriate for the less compiler. We should probably adhere to existing patterns that exist within the make community. Especially in contrast to introduce any breaking changes.

For more details:
https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC11

Our usage was that we had dynamic target files AA...An that had dependencies BA...Gn. For each target we generated roughly 6 outputs where any change of any share dependency that was shared all the targets and their outputs would be invalidated and recreated.

But hey, It's not my project, I'm not actively using less anymore(switched to rails & sass), and my old workplace is using ninja instead of make nowadays.

@StefanWallin
Copy link
Contributor

You could add a flag to do different kind of ouputs, but then again, I'm not sure how big impact on the existing make+less community this would have.

@mjvotaw
Copy link

mjvotaw commented Mar 18, 2015

For whatever my opinion is worth, I think having an additional flag to only output to stdout would be helpful. I've got a plugin for compiling Less that utilizes --depends, and some users are complaining about the extraneous file that gets created. While of course it won't be hard to just delete the file after running, it would be nice if I had some way of getting the information without creating the file in the first place.

@matthew-dean
Copy link
Member

You can generate a sourcemap and also extract the sources from that. But that only lists the root and other referenced files if they directly generate output. It would be nice if there were a more direct way to retrieve a full list of "related" or referenced files (but I don't use make, so I'm unfamiliar with this feature).

@stale
Copy link

stale bot commented Nov 14, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 14, 2017
@stale stale bot closed this as completed Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants