-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpFile.coffee
64 lines (49 loc) · 1.3 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
gulp = require 'gulp'
autowatch = require 'gulp-autowatch'
source = require 'vinyl-source-stream'
buffer = require 'vinyl-buffer'
cp = require 'child_process'
stylus = require 'gulp-stylus'
coffeeify = require 'coffeeify'
browserify = require 'browserify'
paths =
public: './public'
elm: './src/elm/**/*.elm'
css: './src/css/*.styl'
js: './src/js/*.coffee'
gulp.task 'coffee', ->
bCache = {}
b = browserify './src/js/app.coffee',
debug: true
interestGlobals: false
cache: bCache
extensions: ['.coffee']
b.transform coffeeify
b.bundle()
.pipe source 'app.js'
.pipe buffer()
.pipe gulp.dest paths.public
gulp.task 'stylus', ->
gulp.src paths.css
.pipe stylus()
.pipe gulp.dest paths.public
gulp.task 'elm', ->
cmd = 'elm-make ./src/elm/main.elm'
cmd += ' --output ./public/elm.js'
cp.exec cmd, (err, stdout) ->
if err
console.log 'ELM ERROR :^('
console.log err
else
console.log 'Elm says .. '
console.log (stdout.slice 0, stdout.length - 1)
gulp.task 'watch', ->
{elm, css, js} = paths
autowatch gulp,
server: './public/*.html'
stylus: css
coffee: js
elm: elm
gulp.task 'server', -> require './server'
gulp.task 'default',
[ 'elm', 'coffee', 'stylus', 'watch', 'server' ]