优化 gulp 任务构建

This commit is contained in:
贤心 2022-08-31 01:47:42 +08:00
parent dd7c3ab33d
commit 763b1f257f

View File

@ -17,11 +17,11 @@ const yargs = require('yargs');
const config = { const config = {
//注释 //注释
comment: [ comment: [
'/** <%= pkg.version %> | <%= pkg.license %> Licensed */<%= js %>' '/** v<%= pkg.version %> | <%= pkg.license %> Licensed */<%= js %>'
,{pkg: pkg, js: ';'} ,{pkg: pkg, js: ';'}
] ]
//模块 //模块
,modules: 'lay,laytpl,laypage,laydate,jquery,layer,util,dropdown,slider,colorpicker,element,upload,form,table,tree,transfer,carousel,rate,flow,layedit,code' ,modules: 'lay,laytpl,laypage,laydate,jquery,layer,util,dropdown,slider,colorpicker,element,upload,form,table,tree,transfer,carousel,rate,flow,code'
}; };
// 获取参数 // 获取参数
@ -60,13 +60,14 @@ const js = () => {
// css // css
const css = () => { const css = () => {
let src = [ let src = [
'./src/css/**/*.css' './src/css/layui.css',
,'!./src/css/**/font.css' './src/css/modules/**/*.css',
'!./src/css/**/font.css'
]; ];
return gulp.src(src).pipe(cleanCSS({ return gulp.src(src).pipe(cleanCSS({
compatibility: 'ie8' compatibility: 'ie8'
})) }))
//.pipe(concat('layui.css', {newLine: ''})) .pipe(concat('layui.css', {newLine: ''}))
.pipe(gulp.dest(dest +'/css')); .pipe(gulp.dest(dest +'/css'));
}; };
@ -113,14 +114,13 @@ exports.rls = gulp.series(cleanRLS, rls); //release task
exports.layer = () => { // gulp layer exports.layer = () => { // gulp layer
let dest = './release/layer'; let dest = './release/layer';
gulp.src('./src/css/modules/layer/default/*') gulp.src('./src/css/modules/layer.css')
.pipe(gulp.dest(dest + '/src/theme/default')); .pipe(gulp.dest(dest + '/src'));
return gulp.src('./src/modules/layer.js') return gulp.src('./src/modules/layer.js')
.pipe(gulp.dest(dest + '/src')); .pipe(gulp.dest(dest + '/src'));
}; };
// laydate task // laydate task
exports.laydate = () => { // gulp laydate exports.laydate = () => { // gulp laydate
let dest = './release/laydate/'; // 发行目录 let dest = './release/laydate/'; // 发行目录
@ -131,7 +131,7 @@ exports.laydate = () => { // gulp laydate
// css // css
gulp.src('./src/css/modules/laydate.css') gulp.src('./src/css/modules/laydate.css')
.pipe(gulp.dest(dest + 'src/')); .pipe(gulp.dest(dest + 'src'));
// js // js
return gulp.src(['./src/layui.js', './src/modules/{lay,laydate}.js']) return gulp.src(['./src/layui.js', './src/modules/{lay,laydate}.js'])