Google Closure Library Bundler
Library for generating a Google Closure Library bundle, based on this demo.
Read more about the Google Closure Library here.
Install
npm install google-closure-library-bundler
Usage
- Create
entry.js
:
goog.require('goog.html.sanitizer.HtmlSanitizer.Builder')
goog.require('goog.html.sanitizer.unsafe')
- Create
build.js
:
const { bundle } = require('google-closure-library-bundler')
const { join } = require('path')
bundle('./entry.js', {
path: join(__dirname, 'dist'),
filename: 'goog.js',
hashFunction: 'md5'
}).then(() => {
console.log('All bundled up!')
})
- Run
build.js
to create a bundle in dist/goog.js
- Include the bundle in your build:
import goog from './dist/goog'
const htmlSanitizerBuilder = new goog.html.sanitizer.HtmlSanitizer.Builder()
API
bundle(entry, output) => Promise<string>