forked from zhufengnodejs/201507gulp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhangrenyang-t510
committed
Dec 22, 2015
1 parent
c8af502
commit a3b3650
Showing
13 changed files
with
57 additions
and
45 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
/** | ||
* Created by Administrator on 2015-12-22. | ||
*/ | ||
//main | ||
console.log('main'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//page | ||
console.log('page'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
/** | ||
* Created by Administrator on 2015-12-22. | ||
*/ | ||
//tmp | ||
console.log('tmp'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
body { | ||
color: red; | ||
width: 400px; | ||
} | ||
h2 { | ||
color: red; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
body { | ||
color: @xxx; | ||
width:400px; | ||
} | ||
h2 { | ||
color: @xxx; | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,11 @@ | ||
var gulp = require('gulp'); | ||
var less = require('gulp-less'); | ||
var connect = require('gulp-connect'); | ||
var rename = require('gulp-rename'); | ||
var imagemin = require('gulp-imagemin'); | ||
|
||
gulp.task('copyhtml',function(){ | ||
gulp.src('app/index.html').pipe(gulp.dest('dist')).pipe(connect.reload()); | ||
gulp.task('copy-images',function(){ | ||
return gulp.src('app/imgs/**/*.{jpg,png}',{base:'app'}) | ||
.pipe(imagemin()) | ||
.pipe(gulp.dest('dist')); | ||
}); | ||
|
||
gulp.task('less',function(){ | ||
gulp.src('app/less/index.less'). | ||
pipe(less()).pipe(gulp.dest('dist/css')).pipe(connect.reload()); | ||
}); | ||
|
||
gulp.task('server',function(){ | ||
connect.server({ | ||
root:'dist',//服务器的根目录 | ||
port:8080 //服务器的地址,没有此配置项默认也是 8080 | ||
, livereload: true //自动刷新 | ||
}); | ||
gulp.watch('app/index.html',['copyhtml']); | ||
gulp.watch('app/less/index.less',['less']); | ||
}); | ||
//运行此任务的时候会在8080上启动服务器, | ||
gulp.task('default',['copyhtml','less','server']); | ||
gulp.task('default',['copy-images']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var gulp = require('gulp'); | ||
var concat = require('gulp-concat');//把多个文件合并成一个文件 | ||
var uglify = require('gulp-uglify') | ||
var rename = require('gulp-rename'); | ||
gulp.task('uglify',function(){ | ||
return gulp.src(['app/js/*.js','!app/js/*tmp.js']) | ||
.pipe(concat('app.js')) | ||
.pipe(gulp.dest('dist/js')) | ||
.pipe(uglify()) | ||
.pipe(rename('app.min.js')) | ||
.pipe(gulp.dest('dist/js')); | ||
}); | ||
|
||
gulp.task('default',['uglify']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var gulp = require('gulp'); | ||
var less = require('gulp-less'); | ||
var minify = require('gulp-minify-css'); | ||
var rename = require('gulp-rename'); | ||
gulp.task('minify',function(){ | ||
return gulp.src('app/less/index.less') | ||
.pipe(less()) | ||
.pipe(gulp.dest('dist/css')) | ||
.pipe(minify()) | ||
.pipe(rename('index.min.css')) | ||
.pipe(gulp.dest('dist/css')); | ||
}); | ||
|
||
gulp.task('default',['less']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var gulp = require('gulp'), | ||
minifyHtml = require("gulp-minify-html"); | ||
|
||
gulp.task('minify-html', function () { | ||
gulp.src('app/*.html') // 要压缩的html文件 | ||
.pipe(minifyHtml()) //压缩 | ||
.pipe(gulp.dest('dist/html')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters