3

I'm trying to minify www/js/app.js to www/js/app.min.js with a source-map: www/js/app.min.js.map.

I also want app.min.js to contain the line //# sourceMappingURL=app.min.js.map

Is this possible to achieve without using the cd command?

So far this is the only thing that works for me: cd www/js && uglifyjs app.js --mangle --compress --stats --source-map app.min.js.map --output app.min.js && cd ../../

I have been referencing https://github.com/mishoo/UglifyJS2#usage --source-map [options] but nothing seems to work, so maybe I'm missing something obvious.

1 Answers1

0

Yes, their guide is very misleading in the source-mapping options!

I've found one should use --source-map includeSources or --source-map url "url" for it to work.

UPDATE: if url or root has spaces in it, you can put all between double and single quotes, eg: --source-map "root='<URL>'"

Bernardo Dal Corno
  • 1,251
  • 1
  • 16
  • 21