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
9512a1d
commit c8af502
Showing
23 changed files
with
163 additions
and
25 deletions.
There are no files selected for viewing
Empty file.
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,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
<link rel="stylesheet" href="css/index.css"> | ||
</head> | ||
<body> | ||
hello world22 | ||
</body> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/** | ||
* Created by Administrator on 2015-12-22. | ||
*/ |
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,3 @@ | ||
/** | ||
* Created by Administrator on 2015-12-22. | ||
*/ |
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,6 @@ | ||
body { | ||
color: red; | ||
} | ||
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@xxx: red; | ||
|
||
body { | ||
color: @xxx; | ||
} | ||
h2 { | ||
color: @xxx; | ||
} |
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 @@ | ||
console.log('jquery2'); |
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 @@ | ||
console.log('src3'); |
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,6 @@ | ||
body { | ||
color: red; | ||
} | ||
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
<link rel="stylesheet" href="css/index.css"> | ||
</head> | ||
<body> | ||
hello world22 | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,21 +1,24 @@ | ||
var gulp = require('gulp'); | ||
var rename = require('gulp-rename'); | ||
//定义一个任务 | ||
var a = 0; | ||
gulp.task('a+',function(cb){ | ||
//one是一个异步执行的任务 | ||
setTimeout(function(){ | ||
a++; | ||
console.log('a++'); | ||
cb(); | ||
},3000); | ||
var less = require('gulp-less'); | ||
var connect = require('gulp-connect'); | ||
|
||
gulp.task('copyhtml',function(){ | ||
gulp.src('app/index.html').pipe(gulp.dest('dist')).pipe(connect.reload()); | ||
}); | ||
gulp.task('a-',function(){ | ||
//one是一个异步执行的任务 | ||
setTimeout(function(){ | ||
a--; | ||
console.log('a--'); | ||
},3000); | ||
|
||
gulp.task('less',function(){ | ||
gulp.src('app/less/index.less'). | ||
pipe(less()).pipe(gulp.dest('dist/css')).pipe(connect.reload()); | ||
}); | ||
|
||
gulp.task('default',['a+','a-']); | ||
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']); |
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,24 @@ | ||
var gulp = require('gulp'); | ||
var less = require('gulp-less'); | ||
var connect = require('gulp-connect'); | ||
|
||
gulp.task('copyhtml',function(){ | ||
gulp.src('app/index.html').pipe(gulp.dest('dist')).pipe(connect.reload()); | ||
}); | ||
|
||
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']); |
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,4 @@ | ||
var gulp = require('gulp'); | ||
gulp.task('copy-other',function(){ | ||
return gulp.src(['app/css/*.css','app/js/*.js','!app/js/tmp.js'],{base:'app'}).pipe(gulp.dest('dist')); | ||
}); |
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,10 @@ | ||
var gulp = require('gulp'); | ||
|
||
/** | ||
* 匹配多个目录 glob | ||
* 可以填写一个数组 | ||
* | ||
*/ | ||
gulp.task('copy-other',function(){ | ||
return gulp.src(['app/css/*.css','app/js/*.js']).pipe(gulp.dest('dist')); | ||
}); |
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,11 @@ | ||
var gulp = require('gulp'); | ||
|
||
gulp.task('one',function(cb){ | ||
var stream = gulp.src('script/**/*.js') | ||
.pipe(gulp.dest('build')); | ||
//return stream; | ||
}); | ||
|
||
gulp.task('default',['one'],function(){ | ||
console.log('default is done'); | ||
}); |
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,21 @@ | ||
var gulp = require('gulp'); | ||
var rename = require('gulp-rename'); | ||
//定义一个任务 | ||
var a = 0; | ||
gulp.task('a+',function(cb){ | ||
//one是一个异步执行的任务 | ||
setTimeout(function(){ | ||
a++; | ||
console.log('a++'); | ||
cb(); | ||
},3000); | ||
}); | ||
gulp.task('a-',function(){ | ||
//one是一个异步执行的任务 | ||
setTimeout(function(){ | ||
a--; | ||
console.log('a--'); | ||
},3000); | ||
}); | ||
|
||
gulp.task('default',['a+','a-']); |
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,21 @@ | ||
var gulp = require('gulp'); | ||
var rename = require('gulp-rename'); | ||
//压缩JS | ||
gulp.task('uglify',function(){ | ||
//do something | ||
console.log('uglify'); | ||
}); | ||
//重启服务 | ||
gulp.task('reload',function(){ | ||
//do something | ||
console.log('reload'); | ||
}); | ||
gulp.task('default',function(){ | ||
//gulp.watch('script/**/*.js', ['uglify','reload']); | ||
|
||
gulp.watch('script/**/*.js', function(event){ | ||
console.log(event.type); //变化类型 added为新增,deleted为删除,changed为改变 | ||
console.log(event.path); //变化的文件的路径 | ||
}); | ||
|
||
}); |
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 @@ | ||
/** | ||
* Created by Administrator on 2015-12-22. | ||
*/ | ||
console.log('jquery2'); |
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 +1 @@ | ||
console.log('hello'); | ||
console.log('src3'); |