[Pkg-javascript-devel] uglify-js

Jonas Smedegaard dr at jones.dk
Mon Jan 14 13:27:04 GMT 2019


UglifyJS2 3.x is now in Debian, and has transitioned to testing.

UglifyJS 1.x is deprecated (works for now but is dead upstream!).

Below is what I believe to be a set of best practices.

I welcome questions/additions/criticism, and suggest putting the parts 
we agree on as best practices up on our wiki pages somewhere 
appropriate.

 - Jonas


# browser library packaging - best practices

  * ship beautified as $BUNDLE.js
    with LibreJS hint
  * ship minified as $BUNDLE.min.js
    with source-map $BUNDLE.min.js.map
  * ship minified as-is, and pre-compressed as gzip and brotli
  * ship README.txt and README.html (e.g. generated from README.md)


## command-line tool - simplest use

Build-Depends: uglifyjs

override_dh_auto_build:
	uglifyjs --output bundle.js \
	  --beautify --comments \
	  -- source1.js source2.js
	uglifyjs --output bundle.min.js \
	  --compress --mangle \
	  -- source1.js source2.js


## command-line tool - with source-map

Build-Depends: uglifyjs (>= 3)

override_dh_auto_build:
	uglifyjs --output bundle.js \
	  --beautify --comments \
	  -- source1.js source2.js
	uglifyjs \
	  --compress --mangle \
	  --source-map "base='$(CURDIR)',url='bundle.min.js.map'" \
	  --output bundle.min.js \
	  -- source1.js source2.js


## Node.js library

Build-depends: node-uglify-js


## browser library

Build-depends: libjs-uglify-js

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20190114/9579229e/attachment.sig>


More information about the Pkg-javascript-devel mailing list