Skip to content

Commit 3b57fe4

Browse files
committed
Lazily create a pipeline out of reusable components for gulp
Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent bb37c05 commit 3b57fe4

File tree

2 files changed

+48
-45
lines changed

2 files changed

+48
-45
lines changed

gulpfile.coffee

+8-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ $ = require('gulp-load-plugins')()
77
minifyCSS = require 'gulp-minify-css'
88
production = true if $.util.env.env is 'production'
99
filename = require('uuid').v4()
10+
lazypipe = require 'lazypipe'
1011

1112
paths =
1213
src: 'app'
@@ -19,23 +20,24 @@ paths =
1920
dist: 'dist'
2021
vendor: 'app/assets/vendor'
2122

23+
coffeelintTasks = lazypipe()
24+
.pipe $.coffeelint
25+
.pipe $.coffeelint.reporter
26+
.pipe $.coffee, bare: true
27+
2228
gulp.task 'coffee', ->
2329
gulp.src paths.coffee + '/**/*.coffee'
2430
.pipe $.if !production, $.changed paths.script,
2531
extension: '.js'
26-
.pipe $.coffeelint()
27-
.pipe $.coffeelint.reporter()
28-
.pipe $.coffee bare: true
32+
.pipe coffeelintTasks()
2933
.pipe gulp.dest paths.script
3034
.pipe $.connect.reload()
3135

3236
gulp.task 'test_coffee', ->
3337
gulp.src paths.test + '/**/*.coffee'
3438
.pipe $.if !production, $.changed paths.test,
3539
extension: '.js'
36-
.pipe $.coffeelint()
37-
.pipe $.coffeelint.reporter()
38-
.pipe $.coffee bare: true
40+
.pipe coffeelintTasks()
3941
.pipe gulp.dest paths.test
4042

4143
gulp.task 'w3cjs', ->

package.json

+40-39
Original file line numberDiff line numberDiff line change
@@ -19,61 +19,62 @@
1919
},
2020
"main": "build/server.js",
2121
"devDependencies": {
22-
"mocha": "^1.18.2",
22+
"LiveScript": "~1.2.0",
23+
"bower": "~1.3.1",
24+
"chai": "~1.9.1",
25+
"coffee-script": "~1.7.1",
26+
"docco": "~0.6.3",
27+
"express": "~3.5.1",
28+
"grunt": "~0.4.4",
29+
"grunt-bower-task": "~0.3.4",
2330
"grunt-cli": "~0.1.12",
24-
"grunt-shell": "~0.6.4",
25-
"grunt-contrib-connect": "~0.7.1",
26-
"grunt-text-replace": "~0.3.11",
31+
"grunt-coffeelint": "0.0.8",
2732
"grunt-contrib-clean": "~0.5.0",
28-
"grunt-contrib-copy": "~0.5.0",
2933
"grunt-contrib-coffee": "~0.10.1",
30-
"grunt-contrib-htmlmin": "~0.2.0",
3134
"grunt-contrib-compass": "~0.7.2",
32-
"grunt-bower-task": "~0.3.4",
33-
"grunt-requirejs": "~0.4.1",
34-
"grunt-manifest": "~0.4.0",
35+
"grunt-contrib-connect": "~0.7.1",
36+
"grunt-contrib-copy": "~0.5.0",
3537
"grunt-contrib-cssmin": "~0.9.0",
38+
"grunt-contrib-htmlmin": "~0.2.0",
39+
"grunt-contrib-imagemin": "^0.6.1",
40+
"grunt-contrib-watch": "^0.6.1",
41+
"grunt-docco2": "~0.2.0",
3642
"grunt-express-server": "~0.4.13",
37-
"chai": "~1.9.1",
43+
"grunt-html-validation": "^0.1.15",
44+
"grunt-manifest": "~0.4.0",
3845
"grunt-mocha-phantomjs": "~0.4.3",
39-
"mocha-phantomjs": "~3.3.2",
40-
"requirejs": "~2.1.11",
41-
"express": "~3.5.1",
42-
"grunt": "~0.4.4",
43-
"bower": "~1.3.1",
44-
"grunt-coffeelint": "0.0.8",
45-
"grunt-docco2": "~0.2.0",
46-
"grunt-contrib-watch": "^0.6.1",
47-
"phantomjs": "^1.9.7-3",
4846
"grunt-remove-logging": "~0.2.0",
49-
"grunt-html-validation": "^0.1.15",
47+
"grunt-requirejs": "~0.4.1",
48+
"grunt-shell": "~0.6.4",
49+
"grunt-text-replace": "~0.3.11",
5050
"gulp": "^3.7.0",
51+
"gulp-cache": "~0.1.3",
52+
"gulp-changed": "~0.3.0",
53+
"gulp-clean": "~0.2.4",
5154
"gulp-coffee": "~1.4.1",
5255
"gulp-coffeelint": "^0.3.2",
53-
"gulp-mocha": "^0.4.1",
54-
"docco": "~0.6.3",
5556
"gulp-compass": "~1.1.8",
56-
"gulp-util": "^2.2.14",
57-
"gulp-w3cjs": "~0.1.2",
58-
"gulp-jshint": "^1.5.3",
59-
"gulp-clean": "~0.2.4",
60-
"gulp-imagemin": "^0.5.0",
61-
"gulp-cache": "~0.1.3",
62-
"grunt-contrib-imagemin": "^0.6.1",
63-
"gulp-changed": "~0.3.0",
6457
"gulp-connect": "~2.0.1",
65-
"gulp-size": "~0.2.0",
66-
"gulp-load-plugins": "^0.5.1",
67-
"coffee-script": "~1.7.1",
68-
"LiveScript": "~1.2.0",
69-
"uuid": "~1.4.1",
70-
"run-sequence": "^0.3.6",
71-
"gulp-if": "^1.2.0",
72-
"gulp-rename": "^1.2.0",
7358
"gulp-htmlmin": "^0.1.2",
59+
"gulp-if": "^1.2.0",
60+
"gulp-imagemin": "^0.5.0",
61+
"gulp-jshint": "^1.5.3",
62+
"gulp-load-plugins": "^0.5.1",
7463
"gulp-minify-css": "^0.3.4",
64+
"gulp-mocha": "^0.4.1",
65+
"gulp-rename": "^1.2.0",
7566
"gulp-replace": "^0.3.0",
76-
"gulp-uglify": "^0.3.0"
67+
"gulp-size": "~0.2.0",
68+
"gulp-uglify": "^0.3.0",
69+
"gulp-util": "^2.2.14",
70+
"gulp-w3cjs": "~0.1.2",
71+
"lazypipe": "^0.2.1",
72+
"mocha": "^1.18.2",
73+
"mocha-phantomjs": "~3.3.2",
74+
"phantomjs": "^1.9.7-3",
75+
"requirejs": "~2.1.11",
76+
"run-sequence": "^0.3.6",
77+
"uuid": "~1.4.1"
7778
},
7879
"optionalDependencies": {},
7980
"scripts": {

0 commit comments

Comments
 (0)