gulp构建
来源:互联网 发布:苏州app软件开发 编辑:程序博客网 时间:2024/06/10 01:41
var gulp = require('gulp');var $ = require('gulp-load-plugins')();var open = require('open');var app = { srcPath: 'src/', devPath: 'build/', prdPath: 'dist/'};gulp.task('lib', function() { gulp.src('bower_components/**/*.js') .pipe(gulp.dest(app.devPath + 'vendor')) .pipe(gulp.dest(app.prdPath + 'vendor')) .pipe($.connect.reload());});gulp.task('html', function() { gulp.src(app.srcPath + '**/*.html') .pipe(gulp.dest(app.devPath)) .pipe(gulp.dest(app.prdPath)) .pipe($.connect.reload());})gulp.task('json', function() { gulp.src(app.srcPath + 'data/**/*.json') .pipe(gulp.dest(app.devPath + 'data')) .pipe(gulp.dest(app.prdPath + 'data'));});gulp.task('less', function() { gulp.src(app.srcPath + 'style/index.less') .pipe($.less()) .pipe(gulp.dest(app.devPath + 'css')) .pipe($.cssmin()) .pipe(gulp.dest(app.prdPath + 'css')) .pipe($.connect.reload());});gulp.task('js', function() { gulp.src(app.srcPath + 'script/**/*.js') .pipe($.plumber()) .pipe($.concat('index.js')) .pipe(gulp.dest(app.devPath + 'js')) .pipe($.uglify()) .pipe(gulp.dest(app.prdPath + 'js')) .pipe($.connect.reload());});gulp.task('image', function() { gulp.src(app.srcPath + 'image/**/*') .pipe($.plumber()) .pipe(gulp.dest(app.devPath + 'image')) .pipe($.imagemin()) .pipe(gulp.dest(app.prdPath + 'image')) .pipe($.connect.reload());});gulp.task('clean', function() { gulp.src([app.devPath, app.prdPath]) .pipe($.clean());});gulp.task('build', ['image', 'js', 'less', 'lib', 'html', 'json']);gulp.task('server', ['build'], function() { $.connect.server({ root: [app.devPath], livereload: true, port: 3000 }); open('http://localhost:3000'); gulp.watch('bower_components/**/*', ['lib']); gulp.watch(app.srcPath + '**/*.html', ['html']); gulp.watch(app.srcPath + 'data/**/*.json', ['json']); gulp.watch(app.srcPath + 'style/**/*.less', ['less']); gulp.watch(app.srcPath + 'script/**/*.js', ['js']); gulp.watch(app.srcPath + 'image/**/*', ['image']);});gulp.task('default', ['server']);
阅读全文
0 0
- gulp构建
- gulp构建
- gulp 构建工具
- gulp项目构建小结
- gulp构建工具整理
- gulp构建指令
- 前端构建工具--Gulp
- gulp前端构建工具
- 构建工具-gulp
- 前端构建工具gulp
- gulp构建web项目
- Gulp前端构建工具
- gulp构建工具
- 前端构建工具gulp
- 前端构建工具gulp
- gulp构建前端环境
- 前端构建工具gulp
- gulp自动化构建工具
- SQL注入之sqlmap爆破sqli-labs-master
- MyBatis(3)--MyBatis一些概念
- mybatis-使用原始dao
- 日期差值
- 获取git仓库
- gulp构建
- MVG读书笔记——三维空间中的射影几何(二)
- 启明之星
- Python爬取天气预报数据,并存入到本地EXCEL中
- mybatis-自动生成mapper接口实现类
- [扩展kmp] hdu6153 A Secret
- 遍历二叉树(递归与非递归)
- android malware
- PS入门-02-椭圆选择框基础操作