Created
September 6, 2016 22:45
-
-
Save robwormald/9e282cda50cb4e9f4318b954f622dc9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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