Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sapics/gulp-uglify-cli
Minify javascript by UglifyJs2 with command line options
https://github.com/sapics/gulp-uglify-cli
gulp uglifyjs2
Last synced: about 1 month ago
JSON representation
Minify javascript by UglifyJs2 with command line options
- Host: GitHub
- URL: https://github.com/sapics/gulp-uglify-cli
- Owner: sapics
- License: mit
- Created: 2016-02-19T08:12:20.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-01-29T02:38:57.000Z (almost 6 years ago)
- Last Synced: 2024-11-01T11:04:05.510Z (about 2 months ago)
- Topics: gulp, uglifyjs2
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 4
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-uglify-cli [![NPM version](https://badge.fury.io/js/gulp-uglify-cli.svg)](https://badge.fury.io/js/gulp-uglify-cli)
Minify javascript by [UglifyJs2](https://github.com/mishoo/UglifyJS2) with command line options for [gulp](https://github.com/gulpjs/gulp).
## Installation
```
npm i -g uglify-js
npm i --save-dev gulp-uglify-cli
```## Usage
```javascript
var uglify = require('gulp-uglify-cli')gulp.task('minifyjs', function(){
return gulp.src('index.js')
.pipe(uglify())
.pipe(gulp.dest('dist'))
})
```## Options
You can use all command line options in [UglifyJs2](https://github.com/mishoo/UglifyJS2#usage).
- String command line option
`uglify('-c -m --screw-ie8')`
- Array command line option
`uglify(['-c', '-m', '--screw-ie8'])`
- Hash option
`uglify({preCommand: 'license.js', command: '-c -m --screw-ie8'})`
By setting `output` option, you can output file directly.
`uglify({command: '-c', output: '/home/test/output.js'})`
By setting `uglifyjs` option, you can use custom uglifyjs path.
`uglify({command: '-c', uglifyjs: '/home/node_modules/.bin/uglifyjs'})`
If you have an error 'Permission Denied' in 'gulp-uglify-cli', please try to use `tmp` option which is accessible file path.
`uglify({command: '-c', tmp: '/tmp/_tmp.js'})`