Socket
Book a DemoInstallSign in
Socket

component-uglifyjs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

component-uglifyjs

UglifyJS plugin for component-builder

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 20 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts