• 关于gulp的应用


    //首先先安装应用
    var
    gulp = require("gulp"); var less = require("gulp-less"); var scss = require("gulp-sass"); var connect = require("gulp-connect"); var concat = require("gulp-concat"); var uglify = require("gulp-uglify"); var minifyCss = require("gulp-minify-css"); var rename = require("gulp-rename"); var imagemin = require("gulp-imagemin"); //创建服务 gulp.task("server",function(){ connect.server({ root:"dist", livereload:true }) }); gulp.task("copy-index",function(){ gulp.src("index.html") .pipe(gulp.dest("dist")) .pipe(connect.reload());//重置 }); gulp.task("copy-libs",function(){ gulp.src("libs/**/*") .pipe(gulp.dest("dist/libs")) .pipe(connect.reload()); }) gulp.task("copy-html",function(){ gulp.src("html/*.html") .pipe(gulp.dest("dist/html")) .pipe(connect.reload()); }) gulp.task("copy-img",function(){ gulp.src("img/**/*") .pipe(gulp.dest("dist/img")) .pipe(connect.reload()); }) gulp.task("myJs",function(){ gulp.src("js/*.js") .pipe(concat("bundle.js")) .pipe(gulp.dest("dist/js")) .pipe(rename("bundle.min.js")) .pipe(uglify()) .pipe(gulp.dest("dist/js")) .pipe(connect.reload()); }) gulp.task("myCss",function(){ gulp.src("less/*.less") .pipe(concat("layout.less")) .pipe(less()) .pipe(gulp.dest("dist/css")) .pipe(rename("layout.min.css")) .pipe(minifyCss()) .pipe(gulp.dest("dist/css")) .pipe(connect.reload()); }) //监听 gulp.task("build",["copy-index","copy-libs","copy-html","copy-img","myJs","myCss"],function(){ console.log("ok") }) gulp.task("watch",function(){ gulp.watch("index.html",["copy-index"]); gulp.watch("html/*.html",["copy-html"]); gulp.watch("libs/**/*",["copy-libs"]); gulp.watch("img/**/*",["copy-img"]); gulp.watch("js/**/*",["myJs"]); gulp.watch("less/**/*",["myCss"]); }) gulp.task("default",["build","watch","server"]);
  • 相关阅读:
    瀑布流-03-通过封装的自定义布局快速实现商品展示
    瀑布流-02-手把手教你封装自定义布局
    瀑布流-01-自定义布局实现绚丽的瀑布流
    CoreAnimation-09-模拟时钟
    CoreAnimation-08-CATransition
    CoreAnimation-07-CAAnimationGroup
    CoreAnimation-06-CAKeyframeAnimation
    CoreAnimation-05-CABasicAnimation
    CoreAnimation-04-核心动画必备基础
    logstash+elasticsearch 错误摘记
  • 原文地址:https://www.cnblogs.com/wym0829/p/6445057.html
Copyright © 2020-2023  润新知