在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):craigjennings11/gulp-uglifyjs开源软件地址(OpenSource Url):https://github.com/craigjennings11/gulp-uglifyjs开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-uglifyjsDEPRECATED: This plugin has been blacklisted as it relies on Uglify to concat the files instead of using gulp-concat, which breaks the "It should do one thing" paradigm. When I created this plugin, there was no way to get source maps to work with gulp, however now there is a gulp-sourcemaps plugin that achieves the same goal. gulp-uglifyjs still works great and gives very granular control over the Uglify execution, I'm just giving you a heads up that other options now exist.
This plugin is based off of gulp-uglify but allows you to directly use all of Uglify's options. The main difference between these two plugins is that passing in an array of files (or glob pattern that matches multiple files) will pass that array directly to Uglify. Uglify will handle both concatenating and minifying those files. Letting Uglify handle the concatenation and minification allows for the
generated source map to be able to separate the files in the browser for easier
debugging, and it avoids the intermediate step of Usagevar uglify = require('gulp-uglifyjs');
gulp.task('uglify', function() {
gulp.src('public/js/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js'))
}); This will concatenate and minify all files found by API
ExamplesTo minify multiple files into a 'app.min.js' and create a source map: gulp.task('uglify', function() {
gulp.src('public/js/*.js')
.pipe(uglify('app.min.js', {
outSourceMap: true
}))
.pipe(gulp.dest('dist/js'))
}); To minify multiple files from different paths to 'app.js', but skip mangling and beautify the results: gulp.task('uglify', function() {
gulp.src(['public/js/*.js', 'bower_components/**/*.js'])
.pipe(uglify('app.js', {
mangle: false,
output: {
beautify: true
}
}))
.pipe(gulp.dest('dist/js'))
}); |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论