Piping browserify with uglify and exorcist in npm scripts

I need help to run a chain of commands in npm scripts when building a js application.

Right now Im running this line:

"scripts": {
    "build-js": "browserify src/app/main.js --debug | exorcist dist/app.js.map > dist/app.js",
}

That browserifies and extracts sourcemaps. But I would also like to minify with uglifyjs2.

How to I pipe uglifyjs to get a minified source with external sourcemaps?

Answers


uglifyify can help you:

browserify -t uglifyify src/app/main.js --debug | exorcist dist/app.js.map > dist/app.js

You can do this:

"browserify": "browserify -e scripts/index.js -d -t browserify-shim | exorcist scripts/bundle.map | uglifyjs -cm > scripts/bundle.js"

Need Your Help

Multiplication, division. What is wrong?

arduino arduino-uno

Simple operations. Calculate time delay.

Error message in UPDATE statement: Syntax error (missing operator) in query expression

vb.net

I don't know why when ever I click on the update button, I get an error