Closed betaorbust closed 9 years ago
@betaorbust thank you for reporting! If you need this ASAP a pull request would be welcome :)
@thanpolas, I'll give it a shot.
Looking at the code it seems I have a couple options:
1) Just write the blank file as soon as it's detected in compiler.compileCommand
(instead of adding to the commands queue)
This is much simpler, but kind of breaks the general queue-commands -> run commands paradigm you have going.
2) Write a specially formatted command to the commands queue from within compiler.compileCommand
, and write it when helpers.executeCommand
is called from helpers.runCommands
This is a bit more complex. Currently commands are strings, and if we want to do it from within grunt (instead exec-ing a string which might have cross-platform issues) it would have to be something like "commands can be strings OR objects that have a function attached to be run at exec time."
Not sure of your preference, so any guidance on what seems more sane to you would be appreciated.
I'm not sure of the expected behavior here but I think you might want to fix the compiler.compileCommand
method itself which is on another repository task-closure-tools.
The specific module/line you are looking for is lib/libCompiler:69.
Hope this helps
The initial issue (where once the glob was expanded, no files were left to be compiled) was fixed in task-closure-tools.
There's one related topic, for this repo, where no files are selected. The use case is where the files src list is externally sorted, and may come back empty.
Currently this throws a No commands produced for shell execution. Check your config file
from closureCompiler.js L62 and quits in failure.
My proposal is to check this.files.length
and then console warn that no files were selected and the task was skipped, but to not fatally terminate.
My personal issue was fixed with the previous tas-closure-tools PR, but figured I'd mention it here for completeness.
Thoughts, @thanpolas?
In reusing build scripts I've come across the following problem.
To reproduce, just add a filter that is a bit too discriminating:
Ideally, if no files are selected, it would be great to see a warning that an empty file was being written to, and just write
MINIFIED_JS
as an effectively empty file without even hitting closure.