Skip to content

Instantly share code, notes, and snippets.

@robwormald
Created September 6, 2016 22:45
Show Gist options
  • Select an option

  • Save robwormald/9e282cda50cb4e9f4318b954f622dc9d to your computer and use it in GitHub Desktop.

Select an option

Save robwormald/9e282cda50cb4e9f4318b954f622dc9d 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