Open sindresorhus opened 10 years ago
I see. Do you know if closure compiler itself allows compilation of stdin? That'd be required to make something like this work. Everything else would still require a temporary file.
Would be something like:
closureProcess.stdin.write(new Buffer('test'));
Any update on this?
Bump, I would also really like to use this inside of a Connect pipeline. It's a shame to have to write content to a temporary file ;(
+1 We demand that :-) Should I send PR?
Any update?
It's possible to use buffer for Closure Compiler. But unfortunatelly not like that:
files.map(function(file) {
var src = file.contents.toString();
jar.stdin.write(src);
});
jar.stdin.end()
From my experiments it seems that closure_entry_point option does not work with piped files. Especially, compiler seems to not be able to reorder files as needed. This https://code.google.com/p/closure-compiler/wiki/ManageClosureDependencies simply does not work. But when I use plain old -js parameter, it works. There is also another issue related to Windows, http://stackoverflow.com/questions/3205027/maximum-length-of-command-line-string Fortunatelly, compiler supports special flag file.
So I am almost decided to use https://github.com/vesln/temporary, there is no other way.
New gulp-closure-compiler (or another name) will be finished soon.
I've created a gulp plugin for Closure Compiler using this excellent module.
Gulp works on streams and buffers and not files while this module requires you to supply files. A lot of other Node things does this too.
It would be useful if you could also supply a buffer that is passed to the Closure Compiler stdin.
Like: