标签:gis rom tar 安装插件 start 生成 list mini 清除
var gulp = require(‘gulp‘); gulp.task(‘default‘, function() { console.log(‘hello world‘); });
具体代码
//var gulp = require(‘gulp‘); // //gulp.task(‘default‘, function() { // console.log(‘hello world‘); //}); // 引入 gulp及组件 var gulp = require(‘gulp‘), autoprefixer = require(‘gulp-autoprefixer‘), minifycss = require(‘gulp-minify-css‘), //压缩css //jshint = require(‘gulp-jshint‘), //js代码校验 uglify = require(‘gulp-uglify‘), //压缩JS imagemin = require(‘gulp-imagemin‘), //压缩图片 rename = require(‘gulp-rename‘), //合并js文件 // concat = require(‘gulp-concat‘), // 将多个文件合并为1个 notify = require(‘gulp-notify‘), cache = require(‘gulp-cache‘), livereload = require(‘gulp-livereload‘), del = require(‘del‘); // Styles gulp.task(‘styles‘, function() { return gulp.src(‘src/styles/**/**/**/**/**/**/**/**/**/*.css‘) .pipe(rename({ suffix: ‘.min‘ })) .pipe(minifycss()) .pipe(gulp.dest(‘dist/styles‘)) .pipe(notify({ message: ‘Styles task complete‘ })); }); // Scripts gulp.task(‘scripts‘, function() { return gulp.src(‘src/scripts/**/**/**/**/**/**/**/**/*.js‘) //.pipe(jshint(‘.jshintrc‘)) // .pipe(jshint.reporter(‘default‘)) // .pipe(concat(‘main.js‘)) .pipe(rename({ suffix: ‘.min‘ })) .pipe(uglify()) .pipe(gulp.dest(‘dist/scripts‘)) .pipe(notify({ message: ‘Scripts task complete‘ })); }); // Images gulp.task(‘images‘, function() { return gulp.src(‘src/images/**/*‘) .pipe(cache(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))) .pipe(gulp.dest(‘dist/images‘)) .pipe(notify({ message: ‘Images task complete‘ })); }); // Clean 任务执行前,先清除之前生成的文件 gulp.task(‘clean‘, function(cb) { del([‘dist/**/**/**/**/**/**/*‘], cb) }); // Default task 设置默认任务 gulp.task(‘default‘, [‘clean‘], function() { gulp.start(‘styles‘, ‘scripts‘, ‘images‘); }); // Watch 监听 gulp.task(‘watch‘, function() { // Watch .scss files gulp.watch(‘src/styles/**/**/**/**/**/**/**/**/**/**/*.css‘, [‘styles‘]); // Watch .js files gulp.watch(‘src/scripts/**/**/**/**/**/**/**/**/**/**/**/*.js‘, [‘scripts‘]); // Watch image files gulp.watch(‘src/images/**/**/**/**/**/**/**/**/**/**/*‘, [‘images‘]); // Create LiveReload server livereload.listen(); // Watch any files in dist/, reload on change gulp.watch([‘dist/**‘]).on(‘change‘, livereload.changed); });
标签:gis rom tar 安装插件 start 生成 list mini 清除
原文地址:http://www.cnblogs.com/zhongmeizhi/p/6703367.html