• gulp自动化打包工具


    /**
    * Created by hasee on 2016/7/5.
    */
    var gulp = require('gulp');
    var sass = require('gulp-sass');//容易出错 plus
    var webserver = require("gulp-webserver");

    /*js*/
    /*var uglify = require("gulp-uglify");*/
    var rename = require("gulp-rename");

    /*css*/
    var concat = require("gulp-concat");
    var autoprefixer = require("gulp-autoprefixer");
    var minifyCSS = require("gulp-minify-css");

    var imagemin = require('gulp-imagemin');//容易出错


    /*开启有一个服务器*/
    gulp.task("webserver",function(){
    gulp.src("./")
    .pipe(webserver({
    livereload: true, /*修改文件自动刷新*/
    directoryListing: { /*要不要显示目录,开发环境下可以显示*/
    enable:true,
    path: './' /*有哪个目录下开始访问*/
    },
    port: 81, /*端口号*/
    host: '172.18.99.189'
    }))
    });

    gulp.task("styles",function(){
    gulp.src("src/sass/*.scss")
    .pipe(sass().on('error', sass.logError))
    /* .pipe(minifyCSS())
    .pipe(concat("index.min.css"))*/
    .pipe(gulp.dest("app/css/"))
    });

    gulp.task("copyHtml",function(){
    gulp.src("src/*.html")
    .pipe(gulp.dest("app/"))
    });


    gulp.task("copyJs",function(){
    gulp.src("src/js/libs/*.js")

    .pipe(gulp.dest("app/js/libs/"))
    });

    gulp.task("script",function(){
    gulp.src("src/js/*.js")
    /* .pipe(jshint())*/
    .pipe(gulp.dest("app/js/"))
    });

    /*创建一个图片压缩的任务*/
    gulp.task("images",function(){
    return gulp.src("src/images/*")
    .pipe(imagemin())
    .pipe(gulp.dest("app/images/"))
    });

    gulp.task("watch",function(){
    gulp.watch("src/sass/*.scss",["styles"]);
    gulp.watch("src/*.html",["copyHtml"]);
    gulp.watch("src/js/*.js",["script"])
    });

    gulp.task("default",["styles","watch","copyHtml","images","copyJs","script",
    "webserver"]);
  • 相关阅读:
    5.Spring常用注解
    4.@Autowired注解与@Resource注解的区别
    3.只读事务@Transactional(readOnly = true)
    2.Object...param参数
    1.private static final long serialVersionUID = 1L
    SOCKET是调用操作系统通信服务的一种机制
    HTTP头和网页分离方法

    Python split()方法
    socket (计算机专业术语)
  • 原文地址:https://www.cnblogs.com/jessical626/p/6489073.html
Copyright © 2020-2023  润新知