zoukankan      html  css  js  c++  java
  • gulp——myself配置

    var gulp = require('gulp'),
        uglify = require('gulp-uglify'),
        concat = require('gulp-concat');
     var pump = require('pump');
     var minifycss = require('gulp-minify-css');
     var htmlmin = require('gulp-htmlmin');
    gulp.task('compress', function (cb) {
        pump([
                gulp.src('app/**/*.js'),
                uglify(),
    
                gulp.dest('build')
            ],
            cb
        );
    });
    
    
    gulp.task('default', function () {
        gulp
            .src('app/**/*.js') // gulp.src从水源地把水取出来,创造第一根管子
            //.pipe(concat('all.js'))
            .pipe(uglify()) // 新建一个管子,然后把水处理器塞到管子里面
            // gulp.dest('build') 其实也是一种水处理器,它的作用是把水引流到某个文件夹下面
            .pipe(gulp.dest('dist/js'))
    });
    /*var htmlmin = require('gulp-htmlmin');
     gulp.task('html', function () {
     var options = {
     collapseWhitespace: true,
     collapseBooleanAttributes: true,
     removeComments: true,
     removeEmptyAttributes: true,
     removeScriptTypeAttributes: true,
     removeStyleLinkTypeAttributes: true,
     minifyJS: true, minifyCSS: true
     };
     gulp.src('app/*.html')
     .pipe(htmlmin(options))
     //.pipe(rename({suffix: '.min'}))
     //.pipe(concat('index.html'))
     .pipe(gulp.dest('/dist/html'));
     });
     */
    
    
    gulp.task('htmlmin', function() {
        return gulp.src(['app/*/*.html', 'app/*.html'])
            .pipe(htmlmin({collapseWhitespace: true}))
            .pipe(gulp.dest('dist/html'))
            //.pipe($.notify({ message: 'htmlmin task done' }));
    });
    
    ////压缩css
    gulp.task('css', function () {
        gulp.src('app/css/*.css')      //压缩的文件
            //.pipe(rename({suffix: '.min'}))
            .pipe(minifycss()) //执行压缩
            .pipe(concat('index.css'))
            .pipe(gulp.dest('./dist/css'))   //输出文件夹
    });
    
    gulp.task('watch',function(){
        var watcher = gulp.watch('app/*.js',['default'])
    
    });
  • 相关阅读:
    符号表实现(Symbol Table Implementations)
    揭开枚举类的面纱(Unlocking the Enumeration/enum Mystery)
    玩转指针(Playing with Pointers)
    什么是空间复杂度(What is actually Space Complexity ?)
    论困于记忆之物(随笔感言)
    【未有之有】洛依文明相关
    告别
    【未有之有】洛森修炼体系整理
    【未有之有】洛森十三圣人
    复苏
  • 原文地址:https://www.cnblogs.com/sxz2008/p/6378519.html
Copyright © 2011-2022 走看看