admin管理员组

文章数量:1429648

I need help to run a chain of mands 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?

I need help to run a chain of mands 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?

Share Improve this question edited Dec 2, 2015 at 8:57 sameh.q 1,7072 gold badges23 silver badges49 bronze badges asked Dec 2, 2015 at 7:29 PresidentenPresidenten 6,44712 gold badges49 silver badges55 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

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"

本文标签: javascriptPiping browserify with uglify and exorcist in npm scriptsStack Overflow