• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

basedRNC/gulp-closure-compiler-old: Gulp plugin for Google Closure Compiler

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

basedRNC/gulp-closure-compiler-old

开源软件地址(OpenSource Url):

https://github.com/basedRNC/gulp-closure-compiler-old

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

gulp-closure-compiler-old

Build Status Dependency Status devDependency Status

Gulp plugin for Google Closure Compiler (forked to be compatible with node >= 0.8.x)

Issues with the output or Java should be reported on the Closure Compiler issue tracker.

Install

npm install --save-dev gulp-closure-compiler-old

Example

Simple optimizations

Simple optimizations for classic minifying.

var gulp = require('gulp');
var closureCompiler = require('gulp-closure-compiler-old');

gulp.task('default', function() {
  gulp.src('src/*.js')
    .pipe(closureCompiler({
      compilerPath: 'bower_components/closure-compiler/compiler.jar',
      fileName: 'build.js'
    }))
    .pipe(gulp.dest('dist'));
});

Advanced optimizations

Advanced optimizations is much more aggressive. It's aimed for libraries like Closure Library.

var gulp = require('gulp');
var closureCompiler = require('gulp-closure-compiler-old');

gulp.task('default', function() {
  gulp.src('src/*.js')
    .pipe(closureCompiler({
      compilerPath: 'bower_components/closure-compiler/compiler.jar',
      fileName: 'build.js',
      compilerFlags: {
        closure_entry_point: 'app.main',
        compilation_level: 'ADVANCED_OPTIMIZATIONS',
        define: [
          "goog.DEBUG=false"
        ],
        externs: [
          'bower_components/este-library/externs/react.js'
        ],
        extra_annotation_name: 'jsx',
        only_closure_dependencies: true,
        output_wrapper: '(function(){%output%})();',
        warning_level: 'VERBOSE'
      }
    }))
    .pipe(gulp.dest('dist'));
});

API

closureCompiler(options)

options

fileName

Type: String
Required

Generated file name.

compilerPath

Type: String
Required

Path to compiler.jar

compilerFlags

Type: Object

Closure compiler flags.

How to download Closure Compiler

Use Bower.

{
  "name": "foo",
  "version": "0.0.0",
  "dependencies": {
    "closure-compiler": "http://dl.google.com/closure-compiler/compiler-latest.zip"
  }
}

Implementation notes

  • Closure compiler supports pipes, but not correctly (issue).
  • You don't need closurebuilder.py script, compiler knows how to resolve dependencies.
  • Java 1.7+ is required.

License

MIT © Daniel Steigerwald




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap