-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.coffee
46 lines (36 loc) · 1.08 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
gulp = require 'gulp'
coffeeify = require 'gulp-coffeeify'
uglify = require 'gulp-uglify'
concat = require 'gulp-concat'
rename = require 'gulp-rename'
gulpif = require 'gulp-if'
browserSync = require 'browser-sync'
ecstatic = require 'ecstatic'
production = process.env.NODE_ENV is 'production'
gulp.task 'scripts', ->
gulp.src(['src/vimage.coffee',
'bower_components/magipack/src/Magipack.js'
])
.pipe(gulpif(/[.]coffee$/, coffeeify(
options: {
debug: !production
insertGlobals : true
extensions: ['.coffee']
}
)))
.pipe(concat('vimage.js'))
.pipe gulpif production, uglify()
.pipe gulpif production, rename('vimage.min.js')
.pipe(gulp.dest('./build'))
gulp.task 'watch', ->
gulp.watch('src/**/*.coffee', ['scripts'], browserSync.reload)
gulp.task 'server', ->
require('http')
.createServer ecstatic root: __dirname + '/'
.listen 3000
gulp.task 'browser-sync', ->
browserSync
proxy: 'localhost:3000'
notify: off
gulp.task('default', ['scripts', 'watch', 'server', 'browser-sync'])
gulp.task('build', ['scripts'])