@ampproject/rollup-plugin-closure-compiler
Rollup + Google Closure Compiler
Last updated 5 months ago by kristoferbaxter .
Apache-2.0 · Repository · Original npm · Tarball · package.json
$ cnpm install @ampproject/rollup-plugin-closure-compiler 
SYNC missed versions from official npm registry.

rollup-plugin-closure-compiler

Leverage Closure Compiler to minify and optimize JavaScript with Rollup.

Generally Closure Compiler will produce superior minification than other projects, but historically has been more difficult to use. The goal of this plugin is to reduce this friction.

Installation

npm install @ampproject/rollup-plugin-closure-compiler --save-dev

Usage

Invoke Closure Compiler from your Rollup configuration.

// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';

export default {
  input: 'main.js',
  output: {
    file: 'bundle.js',
    format: 'iife',
  },
  plugins: [
    compiler(),
  ],
}

If you would like to provide additional flags and options to Closure Compiler, pass them via key-value pairs.

// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';

export default {
  input: 'main.js',
  output: {
    file: 'bundle.js',
    format: 'iife',
  },
  plugins: [
    compiler({
      formatting: 'PRETTY_PRINT'
    }),
  ],
}

Automatic Closure Configuration

This plugin will modify the enable the assume_function_wrapper output option for Closure Compiler when es format is specifed to Rollup. Note: This is overrideable via passed flags and options.

// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';

export default {
  input: 'main.js',
  output: {
    file: 'bundle.js',
    format: 'es',
  },
  plugins: [
    compiler(),
  ],
}

If your Rollup configuration outputs an IIFE format bundle with a specified name, this plugin will add an extern to ensure the name does not get mangled. Note: This is overrideable via passed flags and options.

// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';

export default {
  input: 'main.js',
  output: {
    file: 'bundle.js',
    format: 'iife',
    name: 'MyAwesomeThing'
  },
  plugins: [
    compiler(),
  ],
}

Security disclosures

The AMP Project accepts responsible security disclosures through the Google Application Security program.

Code of conduct

The AMP Project strives for a positive and growing project community that provides a safe environment for everyone. All members, committers and volunteers in the community are required to act according to the code of conduct.

License

rollup-plugin-closure-compiler is licensed under the Apache License, Version 2.0.

Current Tags

  • 0.9.0-beta.7                                ...           beta (2 years ago)
  • 0.26.0                                ...           latest (5 months ago)
  • 0.5.0-alpha.2                                ...           next (2 years ago)

60 Versions

  • 0.26.0                                ...           5 months ago
  • 0.25.2                                ...           6 months ago
  • 0.25.1                                ...           6 months ago
  • 0.25.0                                ...           6 months ago
  • 0.24.0                                ...           8 months ago
  • 0.23.0                                ...           8 months ago
  • 0.22.2                                ...           8 months ago
  • 0.22.1                                ...           8 months ago
  • 0.22.0                                ...           8 months ago
  • 0.21.0                                ...           9 months ago
  • 0.20.0                                ...           9 months ago
  • 0.19.1                                ...           9 months ago
  • 0.19.0                                ...           9 months ago
  • 0.18.1                                ...           10 months ago
  • 0.18.0                                ...           10 months ago
  • 0.17.0                                ...           10 months ago
  • 0.16.0                                ...           10 months ago
  • 0.15.0                                ...           10 months ago
  • 0.14.1                                ...           10 months ago
  • 0.14.0                                ...           10 months ago
  • 0.13.0                                ...           a year ago
  • 0.12.2                                ...           a year ago
  • 0.12.1                                ...           a year ago
  • 0.12.0                                ...           a year ago
  • 0.11.0                                ...           a year ago
  • 0.10.0                                ...           a year ago
  • 0.9.0                                ...           2 years ago
  • 0.8.5                                ...           2 years ago
  • 0.8.4                                ...           2 years ago
  • 0.9.0-beta.7                                ...           2 years ago
  • 0.9.0-beta.6                                ...           2 years ago
  • 0.9.0-beta.5                                ...           2 years ago
  • 0.9.0-beta.4                                ...           2 years ago
  • 0.9.0-beta.3                                ...           2 years ago
  • 0.9.0-beta.2                                ...           2 years ago
  • 0.9.0-beta.1                                ...           2 years ago
  • 0.8.3                                ...           2 years ago
  • 0.8.2                                ...           2 years ago
  • 0.8.1                                ...           2 years ago
  • 0.8.0                                ...           2 years ago
  • 0.7.3                                ...           2 years ago
  • 0.7.2                                ...           2 years ago
  • 0.7.1                                ...           2 years ago
  • 0.7.0                                ...           2 years ago
  • 0.6.2                                ...           2 years ago
  • 0.6.1                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.5.0-alpha.5                                ...           2 years ago
  • 0.5.0-alpha.4                                ...           2 years ago
  • 0.5.0-alpha.3                                ...           2 years ago
  • 0.5.0-alpha.2                                ...           2 years ago
  • 0.5.0-alpha.1                                ...           2 years ago
  • 0.4.3                                ...           2 years ago
  • 0.4.2                                ...           2 years ago
  • 0.4.1                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
Downloads
Today 1
This Week 2
This Month 73
Last Day 1
Last Week 68
Last Month 167
Dependencies (7)
Dev Dependencies (18)

Copyright 2014 - 2016 © taobao.org |