-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.coffee
executable file
·71 lines (60 loc) · 1.52 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
gulp = require 'gulp'
util = require 'gulp-util'
concat = require 'gulp-concat'
smaps = require 'gulp-sourcemaps'
coffee = require 'gulp-coffee'
sass = require 'gulp-ruby-sass'
haml = require 'gulp-ruby-haml'
# 防止编译 coffee 过程中 watch 进程中止
plumber = require("gulp-plumber")
app =
src:
js: 'src/js/**/*.coffee'
game: 'src/game/*.coffee'
css: 'src/css/*.scss'
html: 'src/html/*.haml'
dist:
js: 'dist/js'
game: '/dist/game'
css: 'dist/css'
html: '.'
gulp.task 'js', ->
gulp.src app.src.js
.pipe plumber()
.pipe smaps.init()
.pipe coffee()
.pipe smaps.write('../maps')
.pipe gulp.dest(app.dist.js)
gulp.task 'game', ->
gulp.src app.src.game
.pipe plumber()
.pipe smaps.init()
.pipe coffee()
.pipe smaps.write('../maps')
.pipe gulp.dest(app.dist.game)
gulp.task 'css', ->
gulp.src app.src.css
.pipe sass()
.on 'error', (err)->
file = err.message.match(/^error\s([\w\.]*)\s/)[1]
util.log [
err.plugin,
util.colors.red file
err.message
].join ' '
.pipe concat('ui.css')
.pipe gulp.dest(app.dist.css)
gulp.task 'html', ->
gulp.src app.src.html
.pipe haml()
.pipe gulp.dest(app.dist.html)
gulp.task 'build', [
'js'
'css'
'html'
]
gulp.task 'default', ['build']
gulp.task 'watch', ['build'], ->
gulp.watch app.src.js, ['js']
gulp.watch app.src.css, ['css']
gulp.watch app.src.html, ['html']