加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gulpfile.js 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
Michael Yang 提交于 2022-05-06 10:30 . build dist
var gulp = require('gulp');
var concat = require('gulp-concat');
var header = require('gulp-header');
var uglify = require("gulp-uglify");
var uglifycss = require("gulp-uglifycss");
var rename = require('gulp-rename');
var pkg = require('./package.json');
var comment = '/*\n' +
' * <%= pkg.name %> <%= pkg.version %>\n' +
' * <%= pkg.description %>\n' +
' * <%= pkg.homepage %>\n' +
' *\n' +
' * Copyright 2022, <%= pkg.author %>\n' +
' * Released under the <%= pkg.license %> license.\n' +
'*/\n\n';
gulp.task('js-minify', function () {
return gulp.src('src/bs-form-builder.js')
.pipe(uglify({}))
.pipe(header(comment, {
pkg: pkg
}))
.pipe(rename('bs-form-builder.min.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('js-minify-components', function () {
return gulp.src('src/bs-form-builder-components.js')
.pipe(uglify({}))
.pipe(header(comment, {
pkg: pkg
}))
.pipe(rename('bs-form-builder-components.min.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('js-concat', function () {
return gulp.src([
'bower_components/Sortable/sortable.min.js',
'dist/bs-form-builder-components.min.js',
'dist/bs-form-builder.min.js',
])
.pipe(concat('bs-form-builder.min.all.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('css-minify', function () {
return gulp.src('src/bs-form-builder.css')
.pipe(uglifycss())
.pipe(rename('bs-form-builder.min.css'))
.pipe(gulp.dest('./dist'));
});
gulp.task('default', gulp.series([
'js-minify',
'js-minify-components',
'js-concat',
'css-minify'
]));
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化