1 Star 0 Fork 0

wuqi001/weui-wxss

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gulpfile.js 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
bearyan 提交于 2020-03-04 17:52 . v2.3.0
const path = require('path');
const gulp = require('gulp');
const less = require('gulp-less');
const rename = require('gulp-rename');
const postcss = require('gulp-postcss');
const cssnano = require('gulp-cssnano');
const header = require('gulp-header');
const autoprefixer = require('autoprefixer');
const pkg = require('./package.json');
let watchTimeout = null;
gulp.task('build:style', function() {
var banner = [
'/*!',
' * WeUI v<%= pkg.version %> (<%= pkg.homepage %>)',
' * Copyright <%= new Date().getFullYear() %> Tencent, Inc.',
' * Licensed under the <%= pkg.license %> license',
' */',
''
].join('\n');
gulp
.src(['src/**/*.less'], { base: 'src' })
.pipe(less())
.pipe(postcss([autoprefixer(['iOS >= 8', 'Android >= 4.1'])]))
.pipe(
cssnano({
zindex: false,
autoprefixer: false,
discardComments: { removeAll: true },
svgo: false
})
)
.pipe(header(banner, { pkg: pkg }))
.pipe(
rename(function(path) {
path.extname = '.wxss';
})
)
.pipe(gulp.dest('dist'));
});
gulp.task('build:example', function() {
gulp
.src(
[
'src/*.!(less)',
'src/**/*.!(less)',
],
{ base: 'src' }
)
.pipe(gulp.dest('dist'));
});
gulp.task('build', ['build:style', 'build:example']);
gulp.task('default', ['build:style', 'build:example'], function() {
gulp.watch(path.resolve(__dirname, 'src/**/*')).on('change', function() {
clearTimeout(watchTimeout);
watchTimeout = setTimeout(() => {
gulp.run(['build:style', 'build:example']);
}, 300);
});
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuqi001/weui-wxss.git
git@gitee.com:wuqi001/weui-wxss.git
wuqi001
weui-wxss
weui-wxss
master

搜索帮助