镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

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

Open

Description

@sindresorhus

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 () {});

Activity

  1. dcodeIO commented on Dec 30, 2013

    @dcodeIO
    Owner

    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.

  2. sindresorhus commented on Dec 30, 2013

    @sindresorhus
    ContributorAuthor
  3. sindresorhus commented on Feb 8, 2014

    @sindresorhus
    ContributorAuthor

    Any update on this?

  4. vjeux commented on Feb 22, 2014

    @vjeux

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

  5. steida commented on Feb 23, 2014

    @steida
    Contributor

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

  6. callumlocke commented on Mar 20, 2014

    @callumlocke

    Any update?

  7. steida commented on Apr 1, 2014

    @steida
    Contributor

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions