gulp

简介: gulp1. 安装npm install --g gulp2. 初始化npm init3.

gulp

1. 安装

npm install --g gulp

2. 初始化

npm init

3. 新建gulpfile.js

var gulp = require('gulp'),
    clean = require('gulp-clean'),
    uglify = require('gulp-uglify'),
    minify = require('gulp-minify-css');

gulp.task('before-clean', function(cb){
    return gulp.src('build').pipe(clean());
});

gulp.task('copy-file', ['before-clean'], function(){
    return gulp.src(['web/**', '!web/static/js/*.js', '!web/static/css/*.css'])
        .pipe(gulp.dest('build/'));
});

gulp.task('js-mini', ['before-clean'], function(){
    return gulp.src('web/static/js/*.js')
        .pipe(uglify()).pipe(gulp.dest('build/static/js'));
});

gulp.task('css-mini', ['before-clean'], function(){
    return gulp.src('web/static/css/*.css')
    .pipe(minify()).pipe(gulp.dest('build/static/css'));
});

gulp.task('build', ['copy-file', 'js-mini', 'css-mini']);

gulp.task('default', ['build']);

4. 运行

gulp
目录
相关文章
|
3月前
|
机器学习/深度学习 监控 数据可视化
Ultralytics是什么?
【8月更文挑战第3天】Ultralytics是什么?
196 0
|
5月前
|
计算机视觉
detectMultiScale
【6月更文挑战第8天】
241 4
|
开发工具 Python
ignatureNonceIsNull
ignatureNonceIsNull
71 1
|
人工智能
Colorful Slimes
题目描述 Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together.
96 0
|
JavaScript 前端开发
|
JavaScript 前端开发