Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Accept a Buffer in addition to files in .compile() #11

Open
sindresorhus opened this issue Dec 30, 2013 · 7 comments
Open

Accept a Buffer in addition to files in .compile() #11

sindresorhus opened this issue Dec 30, 2013 · 7 comments

Comments

@sindresorhus
Copy link
Contributor

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:

ClosureCompiler.compile(new Buffer('function foo() {}'), {}, function () {});
@dcodeIO
Copy link
Owner

dcodeIO commented Dec 30, 2013

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.

@sindresorhus
Copy link
Contributor Author

@sindresorhus
Copy link
Contributor Author

Any update on this?

@vjeux
Copy link

vjeux commented Feb 22, 2014

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 ;(

@steida
Copy link
Contributor

steida commented Feb 23, 2014

+1 We demand that :-) Should I send PR?

@callumlocke
Copy link

Any update?

@steida
Copy link
Contributor

steida commented Apr 1, 2014

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants