Uglify extension for Fepper client-side JavaScript
Install
cd extend
npm install --save-dev fp-uglify
Use
Add these tasks to extend/contrib.js
- Under gulp task 'contrib:frontend-copy'
- 'uglify'
- Under gulp task 'contrib:static'
- 'uglify'
On the command line:
fp uglify
This extension minifies .js
files in the paths.source.jsSrc
directory as
declared in patternlab-config.json
. This minifies with
UglifyJS, so
ES6+ is not supported.
Options can be set in pref.yml
as per these examples:
uglify:
# Respects most options documented at
# https://github.com/mishoo/UglifyJS2#minify-options
# The sourceMap option is a little different.
# Setting it to true writes default external sourcemaps,
# one per `.js` file.
# By default, external sourcemaps will take the name of
# the `.js` file and append `.map`.
sourceMap: true
The following will write sourcemaps inline:
uglify:
sourceMap:
url: inline
Tasks
'uglify'
- Writes the minified JavaScript to the
paths.source.jsBld
directory as declared inpatternlab-config.json
. The minified files will have.min.js
extensions.