@zilero/gulp-js-squeezer
v1.0.4
Published
A Gulp plugin that can be used to minify JavaScript files.
Readme
📦 Powerful Gulp plugin for JavaScript minification with Terser.
Installation • Options • Example
✨ Features
- 📦 JavaScript minification using Terser
- 🔧 Highly configurable
- 📝 TypeScript support
- 🚀 Stream-based processing
- 💡 Progress logging
- 🛠️ Pre and post processing hooks
🚀 Installation
npm install @zilero/gulp-js-squeezer --save-dev
# or
yarn add @zilero/gulp-js-squeezer --dev
# or
pnpm add @zilero/gulp-js-squeezer --save-dev⚙️ Options
minifyOptions
- Type:
MinifyOptions - Required:
false - Terser minification options
pluginOptions
- Type:
object - Required:
false
pluginOptions.onBeforeMinify
- Type:
(content: string) => Promise<string> | string - Required:
false - Transform content before minification
pluginOptions.onAfterMinify
- Type:
(content: string) => Promise<string> | string - Required:
false - Transform content after minification
📝 Example
gulp.task('advanced-minify', () => {
return gulp.src('src/**/*.js')
.pipe(GulpJsSqueezer({
minifyOptions: {
compress: {
dead_code: true,
drop_console: true
},
mangle: true
},
pluginOptions: {
onBeforeMinify: (content) => {
// Custom pre-processing
return content;
},
onAfterMinify: (content) => {
// Custom post-processing
return content;
}
}
}))
.pipe(gulp.dest('dist'));
});🤝 Contributing
If you would like to contribute to the project, please create a pull request or leave feedback. We are always open to new ideas and improvements!
🐛 Issues
Found a bug? Want to request a feature? Please create an issue.
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ by Zilero
