Necrotizing Pineapple Music
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

uglify-register

1.0.1 • Public • Published

uglify-register Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

Use this require hook to uglify JS files on-the-fly.

This is particularly useful when trying to replicate production minification effects in a dev or test environment.

Not recommended for a production environment, like all require hooks.

Install

npm install --save-dev uglify-register

Usage

With no extra uglify options; only for the .js extension; for all files:

require('uglify-register');

With custom uglify options:

require('uglify-register/api')({
    uglify: {
        mangle: true // for example
    },
});

With custom file extensions:

require('uglify-register/api')({
    extensions: ['.js', '.jsx'], // defaults to just ".js" if omitted
});

Excluding files that match provided regular expressions:

require('uglify-register/api')({
    exclude: [
        /\/node_modules\/// third-party code
        /\/test\//, // code under a "test" dir
        \/some-special-file.js$\/, // some file
    ],
});

All options can of course be combined.

Tests

Simply clone the repo, npm install, and run npm test

install

npm i uglify-register

Downloadsweekly downloads

224

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability