代码拉取完成,页面将自动刷新
var gulp = require('gulp'),
connect = require('gulp-connect'),
babel = require('gulp-babel'),
clean = require('gulp-clean'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
minifyCSS = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer');
gulp.task('reloadfile',function(){
gulp.src('src/**/*.*')
.pipe(connect.reload());
});
gulp.task('minjs',()=>{
var stream = gulp.src('src/*.js')
.pipe(babel({
presets:['es2015']
}))
.pipe(concat('jquery.cme-uploadImage.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
return stream;
});
gulp.task('js',()=>{
var stream = gulp.src('src/*.js')
.pipe(babel({
presets:['es2015']
}))
.pipe(concat('jquery.cme-uploadImage.js'))
.pipe(gulp.dest('dist/js'));
return stream;
});
gulp.task('minCss',()=>{
var stream = gulp.src('src/css/*.css')
.pipe(minifyCSS())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('dist/css'));
return stream;
});
gulp.task('css',()=>{
var stream = gulp.src('src/css/*.css')
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('dist/css'));
return stream;
});
gulp.task('clean',()=>{
var stream = gulp.src('dist')
.pipe(clean());
return stream;
});
gulp.task('connect',function(){
connect.server({
livereload: true,
port: 8000
});
});
gulp.task('watch',function(){
gulp.watch('src/**/*.*',['dev']);
});
gulp.task('dev',['clean'],()=>{
gulp.start('js','css','reloadfile');
});
gulp.task('default',['connect','clean'],()=>{
gulp.start('js','css','watch');
});
gulp.task('release',['clean'],()=>{
gulp.start('minjs','minCss');
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。