forked from jessepollak/card
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
63 lines (51 loc) · 1.59 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
gulp = require 'gulp'
browserify = require 'browserify'
prefix = require 'gulp-autoprefixer'
spawn = require('child_process').spawn
server = require('tiny-lr')()
livereload = require('gulp-livereload')
rename = require 'gulp-rename'
rimraf = require 'gulp-rimraf'
connect = require 'gulp-connect'
open = require 'gulp-open'
derequire = require 'gulp-derequire'
runs = require 'run-sequence'
glob = require 'glob'
source = require 'vinyl-source-stream'
rename = require 'gulp-rename'
es = require 'event-stream'
path = require 'path'
development = process.env.NODE_ENV == 'development'
gulp.task 'browserify', (done) ->
glob './src/coffee/*.coffee', (err, files) ->
done(err) if err
tasks = files.map (entry) ->
b = browserify
entries: [entry]
debug: development
standalone: if development then null else 'card'
extensions: ['.coffee', '.js']
b.bundle().on 'error', console.log
.pipe source path.basename(entry)
.pipe derequire()
.pipe rename(extname: '.js')
.pipe gulp.dest('./lib/js')
es.merge(tasks).on 'end', done
gulp.task 'watch', ['browserify', 'connect'], ->
server.listen 35729, ->
gulp.watch ['./src/coffee/**/*.coffee', './src/scss/**/*.scss'], ['browserify']
gulp.src('example/index.html')
.pipe open("", url: "http://localhost:8080/example")
gulp.task 'connect', ->
connect.server()
gulp.task 'clean', ->
gulp.src 'build'
.pipe rimraf()
# Default task call every tasks created so far.
gulp.task 'build', (cb) ->
runs(
'clean'
'browserify',
cb
)
gulp.task 'default', ['build']