Skip to content
UglifyJS plugin for component-builder
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
CHANGELOG.md
README.md
index.js
package.json

README.md

component-uglifyjs

UglifyJS plugin for component-builder

Installing

npm install component-uglifyjs

Usage

To enable UglifyJS minification of your scripts, run the following code:

var Builder = require('component-builder');
var uglify = require('component-uglifyjs');
var fs = require('fs');

var builder = new Builder(__dirname);

builder.use(uglify);

// or if you want to pass options to uglify:
builder.use(uglify.withOptions({ mangle: false, outSourceMap: true }));

builder.build(function (error, build) {
    if (error) {
        throw error;
    }

    fs.writeFileSync('build/build.js', build.require + build.js);

    if (build.css) {
        fs.writeFileSync('build/build.css', build.css);
    }

    // NOTE: sourcemaps are stored on the builder, not the build!

    if (builder.sourcemaps) {
        fs.writeFileSync('build/sourcemaps.json', JSON.stringify(builder.sourcemaps));
    }
});

Or from the command line:

component build --use component-uglifyjs

License

MIT

Something went wrong with that request. Please try again.