代码拉取完成,页面将自动刷新
var gulp = require('gulp'),
$ = require('gulp-load-plugins')({rename: {'gulp-rev-append': 'rev'}});
var pkg = require('./package.json');
var AUTOPREFIXER_BROWSERS = ["Android >= 4", "Explorer >= 10", "iOS >= 6"];
// 注释信息
var banner = '/*! <%= pkg.title %> v<%= pkg.version %> by YDCSS (c) ' +
$.util.date(Date.now(), 'UTC:yyyy') + ' Licensed <%= pkg.license %>' + ' */ \n';
gulp.task('less', function () {
gulp.src(['src/less/{ydui,demo}.less'])
.pipe($.plumber({errorHandler: $.notify.onError('Error: <%= error.message %>')}))
.pipe($.less())
.pipe($.autoprefixer({
browsers: AUTOPREFIXER_BROWSERS, cascade: false
}))
.pipe(gulp.dest('src/css'))
.pipe($.livereload());
});
gulp.task('concat', function () {
gulp.src(['src/js/source/ydui.js', 'src/js/source/**/*.js'])
.pipe($.concat('ydui.js'))
.pipe(gulp.dest('src/js'));
});
gulp.task('watch', function () {
$.livereload.listen();
gulp.watch('src/less/**/*.less', ['less']);
gulp.watch('src/js/source/**/*.js', ['concat']);
});
gulp.task('build:cssmin', ['less'], function () {
gulp.src('src/css/ydui.css')
//.pipe($.cssBase64({
// extensionsAllowed: ['.ttf']
//}))
.pipe($.cleanCss({keepSpecialComments: '*'}))
.pipe($.header(banner, {pkg: pkg}))
.pipe(gulp.dest('dist/build/css'));
});
gulp.task('build:uglify', function () {
gulp.src(['src/js/{ydui.js,ydui.flexible.js}'])
.pipe($.uglify())
.pipe($.header(banner, {pkg: pkg}))
.pipe(gulp.dest('dist/build/js'));
});
gulp.task('demo:css', function () {
gulp.src(['src/less/{ydui,demo}.less']).pipe($.sourcemaps.init())
.pipe($.less())
.pipe($.cssBase64({
extensionsAllowed: ['.ttf']
}))
.pipe($.autoprefixer({
browsers: AUTOPREFIXER_BROWSERS, cascade: false, remove: true
}))
.pipe($.sourcemaps.write('./'))
.pipe(gulp.dest('dist/demo/css'));
});
gulp.task('demo:html', function () {
gulp.src(['src/html/**/*.html', 'src/index.html', 'src/libs/**/*.html'], {base: 'src'})
.pipe($.rev())
.pipe(gulp.dest('dist/demo'));
});
gulp.task('demo:uglify', function () {
gulp.src(['src/js/{ydui.js,ydui.flexible.js}'])
.pipe(gulp.dest('dist/demo/js'));
});
gulp.task('dev', ['less', 'concat', 'watch']);
gulp.task('demo', ['demo:css', 'demo:uglify', 'demo:html']);
gulp.task('default', ['build:cssmin', 'build:uglify']);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。