Skip to content

Instantly share code, notes, and snippets.

@mloayzagahona
Forked from robwormald/rollup-plugin.ts
Created October 23, 2016 10:20
Show Gist options
  • Save mloayzagahona/70f4e81ffcfc6ceb9c780e2f09235a0a to your computer and use it in GitHub Desktop.
Save mloayzagahona/70f4e81ffcfc6ceb9c780e2f09235a0a to your computer and use it in GitHub Desktop.
var closure = require('google-closure-compiler-js')
function closureCompilerPlugin(options = {}){
return {
transformBundle(bundle){
const compilation = Object.assign({}, options, {
jsCode: options.jsCode ? options.jsCode.concat({ src: bundle }) : [{ src: bundle }]
});
const transformed = closure.compile(compilation);
return { code: transformed.compiledCode, map: transformed.sourceMap };
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment