-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.coffee
50 lines (44 loc) · 1.55 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
gulp = require 'gulp'
gulpCoffee = require 'gulp-coffee'
gulpPug = require 'gulp-pug'
gulpChmod = require 'gulp-chmod'
child_process = require 'child_process'
## npm run pug / npx gulp pug: builds index.html from index.pug etc.
exports.pug = pug = ->
gulp.src '*.pug'
.pipe gulpPug pretty: false #true
# working around bug that <label> and <input> add extra spaces
# in pretty mode
.pipe gulpChmod 0o644
.pipe gulp.dest './'
## npm run coffee / npx gulp coffee: builds index.js from index.coffee etc.
exports.coffee = coffee = ->
gulp.src ['index.coffee', 'pieces.coffee'], ignore: 'gulpfile.coffee'
.pipe gulpCoffee()
.pipe gulpChmod 0o644
.pipe gulp.dest './'
## npm run build / npx gulp build: all of the above
exports.build = build = gulp.series pug, coffee
## npm run font / npx gulp font:
## * builds pieces7 from font7 via pieces.sh
## * builds pieces7/*/*.svg via svgtiler
## * builds allfont.html via `coffee allfont.coffee`
exports.font = font = ->
for command in [
'./pieces.sh'
'svgtiler svgtileset.coffee font*/*.asc pieces*/*/*.asc'
'coffee allfont.coffee'
]
console.log "\t#{command}"
child_process.spawnSync command,
stdio: 'inherit'
shell: true
## npm run watch / npx gulp watch: continuously update above
exports.watch = watch = ->
gulp.watch '*.pug', ignoreInitial: false, pug
gulp.watch '*.styl', pug
gulp.watch ['index.coffee', 'pieces.coffee'],
ignoreInitial: false
, coffee
#gulp.watch ['allfont.coffee', 'pieces.coffee', 'font7/*'], ignoreInitial: false, allfont
exports.default = pug