-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.coffee
More file actions
87 lines (69 loc) · 1.75 KB
/
Copy pathgulpfile.coffee
File metadata and controls
87 lines (69 loc) · 1.75 KB
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
gulp = require 'gulp'
nib = require 'nib'
express = require 'express'
browserify = require 'browserify'
watchify = require 'watchify'
coffeeify = require 'coffeeify'
source = require 'vinyl-source-stream'
buffer = require 'vinyl-buffer'
cache = require 'gulp-cached'
stylus = require 'gulp-stylus'
reload = require 'gulp-livereload'
concat = require 'gulp-concat'
autowatch = require 'gulp-autowatch'
# paths
paths =
img: './client/img/**/*'
bundle: './client/index.coffee'
html: './client/**/*.html'
stylus: './client/**/*.styl'
vendor: './client/vendor/**'
# javascript
args =
fullPaths: true
cache: {}
packageCache: {}
extensions: ['.coffee']
bundler = watchify browserify paths.bundle, args
bundler.transform coffeeify
bundle = ->
bundler.bundle()
.once 'error', (err) ->
console.error err.message
.pipe source 'index.js'
.pipe buffer()
.pipe cache 'js'
.pipe gulp.dest './public'
.pipe reload()
gulp.task 'html', ->
gulp.src paths.html
.pipe cache 'html'
.pipe gulp.dest './public'
.pipe reload()
gulp.task 'img', ->
gulp.src paths.img
.pipe cache 'img'
.pipe gulp.dest './public/img'
.pipe reload()
gulp.task 'stylus', ->
gulp.src paths.stylus
.pipe stylus
use: nib()
.pipe concat 'index.css'
.pipe gulp.dest './public'
.pipe reload()
gulp.task 'vendor', ->
gulp.src paths.vendor
.pipe gulp.dest './public'
.pipe reload()
gulp.task 'server', (cb) ->
server = require './server'
cb()
gulp.task 'js', bundle
gulp.task 'watch', (cb) ->
reload.listen()
bundler.on 'update', gulp.parallel 'js'
autowatch gulp, paths
cb()
gulp.task 'build', gulp.parallel 'js', 'stylus', 'html', 'img'
gulp.task 'default', gulp.series 'server', 'build', 'watch', 'vendor'