npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minify-js

v0.0.4

Published

Minification javascript files for ECMA 5 and ECMA 6. May be etc.

Downloads

628

Readme

minify-js

library for minification javascript files

Installation


npm install minify-js --save

example


var minify = require('./index');
var async = require('async');
var ut = require('util');

async.series([

	(done) => {
		console.log('Test compres one file');
		minify.file({
			file : './for-example/src/experimental.js',
			dist : './for-example/experimental.min.js'
		}, (e, compress) => {

			if (e) {
				console.log('ERROR ', e);
				return done();
			}

			compress.run((e) => {
				e ? console.log('Process fail', e) : console.log('Process sucess');
				done();
			});
		});
	},
	(done) => {
		console.log('Test compres two files');
		minify.files([
			{
				file : './for-example/src/experimental.js',
				dist : './for-example/two/experimental.min.js'
			},
			{
				file : './for-example/src/experimental1.js',
				dist : './for-example/two/experimental2.min.js'
			}
		], (e, compress) => {

			if (e) {
				console.log('ERROR ', e);
				return done();
			}

			compress.run((e) => {
				e ? console.log('Process fail', e) : console.log('Process sucess');
				done();
			});
		});
	},
	(done) => {
		console.log('Test compres all files in dirs');
		minify.dir({
			dir : 'for-example/src',
			target : 'for-example/target',
			add : '.min'
		}, (e, compress) => {

			if (e) {
				console.log('ERROR ', e);
				return done();
			}

			compress.run((e) => {
				e ? console.log('Process fail', e) : console.log('Process sucess');
				done();
			});
		});
	},
	(done) => {
		console.log('Test compres lib file');
		minify.file({
			file : './lib/minify-js.js',
			dist : './lib/prod/minify-js.js'
		}, (e, compress) => {

			if (e) {
				console.log('ERROR ', e);
				return done();
			}

			compress.run((e) => {
				e ? console.log('Process fail', e) : console.log('Process sucess');
				done();
			});
		});
	}
], function (e) {
	console.log('The end :)');
});

minify-js~Frame

It is a frame for other classes

Kind: inner class of minify-js

frame.err(mess, data) ⇒ Object

Return error object and set flag for stop process

Kind: instance method of Frame

| Param | | --- | | mess | | data |

frame.warn(mess, that)

Get text for message

Kind: instance method of Frame

| Param | Type | | --- | --- | | mess | String | | that | Class |

minify-js~MinifyFile

Minification one javascript file

Kind: inner class of minify-js

minifyFile.run(cb)

Start process

Kind: instance method of MinifyFile

| Param | Type | | --- | --- | | cb | function |

minifyFile.fileRead(cb)

Get file contents

Kind: instance method of MinifyFile

| Param | Type | | --- | --- | | cb | function |

minifyFile.save(cb)

Save result

Kind: instance method of MinifyFile

| Param | Type | | --- | --- | | cb | function |

minifyFile.compess(cb)

Compress file contents

Kind: instance method of MinifyFile

| Param | Type | | --- | --- | | cb | function |

minifyFile.validOptions(opt, cb) ⇒ *

Check options

Kind: instance method of MinifyFile

| Param | Type | | --- | --- | | opt | Object | | cb | function |

minify-js~MinifyFiles

Minification not one javascript file

Kind: inner class of minify-js

minifyFiles.validOptions(opt, cb) ⇒ *

Check options

Kind: instance method of MinifyFiles

| Param | Type | | --- | --- | | opt | Array | | cb | function |

minifyFiles.run(cb)

Start process

Kind: instance method of MinifyFiles

| Param | Type | | --- | --- | | cb | function |

minify-js~MinifyFilesDir

Minification all javascript file in folder

Kind: inner class of minify-js

minifyFilesDir.validOptions(opt, cb) ⇒ *

Check options Format options {dir : 'source folder', targer : 'destination folder' , add : 'add to name' }

Kind: instance method of MinifyFilesDir

| Param | Type | | --- | --- | | opt | Object | | cb | function |

minifyFilesDir.run(cb)

Start process

Kind: instance method of MinifyFilesDir

| Param | Type | | --- | --- | | cb | function |

version


0.0.3 - Attach unit test. 0.0.4 - More solution for compress.