UNPKG

atme

Version:

76 lines (61 loc) 1.88 kB
var gulp = require('gulp'), del = require('del'), // fileinclude = require('gulp-file-include'), // proxy = require('http-proxy-middleware'), concat = require('gulp-concat'), batch = require('gulp-batch'), watch = require('gulp-watch'), stylus = require('gulp-stylus'); // rename = require('gulp-rename'), // uglify = require('gulp-uglify'), // browserSync = require('browser-sync').create(); // 清除 dist 文件夹 gulp.task('clean',function(){ return del.sync('/css'); }); // html 整合 // gulp.task('html',function(){ // return gulp.src('./src/pages/**/*.html',function(a,b,c){ // console.log('src方法参数一'); // console.log(a); // console.log('src方法参数二'); // console.log(b); // console.log('src方法参数三'); // console.log(c); // }) // .pipe(fileinclude()) // .pipe(gulp.dest('./src/dist')); // }); // 配置编译 stylus gulp.task('stylus',function(){ return gulp.src(['./stylus/**/*.styl','!./stylus/val.styl']) .pipe(stylus()) .pipe(gulp.dest('./css')) }) gulp.task('watch',function(){ return watch('stylus',function(events,done){ gulp.start('stylus'); }) }); // 压缩 js // gulp.task('uglify',function(){ // return gulp.src('./src/js/**/*.js') // .pipe(uglify()) // .pipe(rename({ // extname: '.min.js' // })) // .pipe(gulp.dest('./src/dist/compress')) // }); // 配置服务器 // gulp.task('serve',['stylus'],function(){ // browserSync.init({ // server: { // baseDir: './src/dist', // middleware: proxy('/api',{target: 'http://121.201.29.42:8080',changeOrigin: true}) // }, // port: 8000 // }); // // 监听 html // gulp.watch(['./src/styl/**/*.styl','./src/pages/**/*.html','./src/js/**/*.js'],['stylus','uglify','html']).on('change',browserSync.reload); // }) gulp.task('default',['clean','stylus','watch']);