google-closure-library-bundler
v2.2.0
Published
Library for generating a Google Closure Library bundle
Downloads
1
Maintainers
Readme
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
:
// for example
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' // required for node 17+
}).then(() => {
console.log('All bundled up!')
})
- Run
build.js
to create a bundle indist/goog.js
- Include the bundle in your build:
import goog from './dist/goog'
// for example
const htmlSanitizerBuilder = new goog.html.sanitizer.HtmlSanitizer.Builder()
API
bundle(entry, output) => Promise<string>
entry
- Webpack Entry Pointoutput
- Webpack Output- Returns: Webpack Stats (as string)