-
Notifications
You must be signed in to change notification settings - Fork 11
/
gulpfile.coffee
109 lines (92 loc) · 2.4 KB
/
gulpfile.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
gulp = require 'gulp'
source = require 'vinyl-source-stream'
buffer = require 'vinyl-buffer'
coffeeify = require 'coffeeify'
browserify = require 'browserify'
jade = require 'gulp-jade'
csso = require 'gulp-csso'
cache = require 'gulp-cached'
coffee = require 'gulp-coffee'
stylus = require 'gulp-stylus'
uglify = require 'gulp-uglify'
concat = require 'gulp-concat'
plumber = require 'gulp-plumber'
reload = require 'gulp-livereload'
htmlmin = require 'gulp-minify-html'
gutil = require 'gulp-util'
gif = require 'gulp-if'
sourcemaps = require 'gulp-sourcemaps'
nib = require 'nib'
autoprefixer = require 'autoprefixer-stylus'
autowatch = require 'gulp-autowatch'
# paths
paths =
vendor: './client/vendor/**/*'
img: './client/img/**/*'
fonts: './client/fonts/**/*'
coffee: './client/**/*.coffee'
coffeeSrc: './client/start.coffee'
stylus: './client/**/*.styl'
jade: './client/**/*.jade'
gulp.task 'server', (cb) ->
require './start'
# javascript
gulp.task 'coffee', ->
bCache = {}
b = browserify paths.coffeeSrc,
debug: true
insertGlobals: true
cache: bCache
extensions: ['.coffee']
b.transform coffeeify
b.bundle()
.pipe source 'start.js'
.pipe buffer()
.pipe plumber()
.pipe gif gutil.env.production, uglify()
.pipe gulp.dest './public'
.pipe reload()
# styles
gulp.task 'stylus', ->
gulp.src paths.stylus
.pipe sourcemaps.init()
.pipe stylus
use:[
nib()
autoprefixer cascade: true
]
sourcemap:
inline: true
.pipe concat 'app.css'
.pipe sourcemaps.write()
.pipe gif gutil.env.production, csso()
.pipe gulp.dest './public'
.pipe reload()
gulp.task 'jade', ->
gulp.src paths.jade
.pipe jade()
.pipe cache 'html'
.pipe gif gutil.env.production, htmlmin()
.pipe gulp.dest './public'
.pipe reload()
gulp.task 'vendor', ->
gulp.src paths.vendor
.pipe cache 'vendor'
.pipe gulp.dest './public/vendor'
.pipe reload()
gulp.task 'img', ->
gulp.src paths.img
.pipe cache 'img'
.pipe gulp.dest './public/img'
.pipe reload()
gulp.task 'fonts', ->
gulp.src paths.fonts
.pipe cache 'fonts'
.pipe gulp.dest './public/fonts'
.pipe reload()
gulp.task 'watch', ->
autowatch gulp, paths
gulp.task 'css', ['stylus']
gulp.task 'js', ['coffee']
gulp.task 'static', ['jade', 'vendor', 'img', 'fonts']
gulp.task 'default', ['js', 'css', 'static', 'server', 'watch']