Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sibiraj-s/gulp-plugin-terser
Gulp plugin to minify files with terser
https://github.com/sibiraj-s/gulp-plugin-terser
gulp gulp-plugin minify terser
Last synced: about 1 month ago
JSON representation
Gulp plugin to minify files with terser
- Host: GitHub
- URL: https://github.com/sibiraj-s/gulp-plugin-terser
- Owner: sibiraj-s
- License: mit
- Created: 2019-12-02T16:01:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-24T09:44:54.000Z (5 months ago)
- Last Synced: 2024-12-26T12:41:48.386Z (about 2 months ago)
- Topics: gulp, gulp-plugin, minify, terser
- Language: JavaScript
- Homepage: https://npm.im/gulp-plugin-terser
- Size: 1.99 MB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-plugin-terser [](https://github.com/sibiraj-s/gulp-plugin-terser/actions) [](https://npm.im/gulp-plugin-terser)
> Gulp plugin to minify files with terser
## Getting Started
### Installation
Installation can be done via package managers such as [npm] or [yarn]
```bash
$ npm install -D gulp-plugin-terser
# or
$ yarn add --dev gulp-plugin-terser
```### Usage
```js
// gulpfile.jsconst gulp = require('gulp');
const terser = require('gulp-plugin-terser');function minify() {
const options = {
suffix: '.min.js',
terserOptions: {
output: {
comments: true,
},
},
};return gulp
.src('dist/*.js', { sourcemaps: true })
.pipe(sourcemap.init())
.pipe(terser(options))
.pipe(sourcemap.write('.'))
.pipe(gulp.dest('dist/', { sourcemaps: '.' }));
}gulp.series(minify);
```The above gulp task will minify all the `.js` files in the dist directory and writes it into a new file with extension `.min.js` in the same directory.
#### Options
- suffix: `{string | boolean}` - defaults to `.min.js`.
- terserOptions: `{object}` - refer https://github.com/terser/terser#minify-options[npm]: https://www.npmjs.com/
[yarn]: https://yarnpkg.com/