在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):ben-eb/gulp-bytediff开源软件地址(OpenSource Url):https://github.com/ben-eb/gulp-bytediff开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-bytediff
InstallWith npm do:
ExampleTake any gulp plugin, or series of gulp plugins, & see how much the build process impacted the file size. This example shows how much gulp-cssnano optimized a CSS file: var gulp = require('gulp');
var bytediff = require('gulp-bytediff');
var cssnano = require('gulp-cssnano');
gulp.task('default', function() {
gulp.src('main.css')
.pipe(bytediff.start())
.pipe(cssnano())
.pipe(bytediff.stop())
.pipe(gulp.dest('./out'));
}); APIbytediff.start() or bytediff()Creates a new property on the file object that saves its current size. bytediff.stop(formatFunction)Outputs the difference between the property saved with the Customise the output of this by using the format function. An example: // ...
.pipe(bytediff.stop(function(data) {
var difference = (data.savings > 0) ? ' smaller.' : ' larger.';
return data.fileName + ' is ' + data.percent + '%' + difference;
}))
.pipe(gulp.dest('./out')); The function gets passed an object with the following properties:
ContributingPull requests are welcome. If you add functionality, then please add unit tests to cover it. LicenseMIT © Ben Briggs |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论