google-closure-library-bundler

2.2.0 • Public • Published

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

  1. Create entry.js:
// for example
goog.require('goog.html.sanitizer.HtmlSanitizer.Builder')
goog.require('goog.html.sanitizer.unsafe')
  1. 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!')
})
  1. Run build.js to create a bundle in dist/goog.js
  2. 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>

Package Sidebar

Install

npm i google-closure-library-bundler

Weekly Downloads

1

Version

2.2.0

License

MIT

Unpacked Size

5.34 kB

Total Files

4

Last publish

Collaborators

  • mhassan1