This repository has been archived by the owner on Apr 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
62 lines (50 loc) · 1.76 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
gulp = require 'gulp'
coffee = require 'gulp-coffee'
es6ModuleTranspiler = require "gulp-es6-module-transpiler"
jasmine = require 'gulp-jasmine'
clean = require 'gulp-clean'
serve = require 'gulp-serve'
browserify = require 'browserify'
source = require 'vinyl-source-stream'
sass = require 'gulp-ruby-sass'
shell = require 'gulp-shell'
gulp.task 'clean', ->
gulp.src 'tmp', read: false
.pipe clean()
gulp.task 'compile-scripts', ->
gulp.src './src/**/*.coffee'
.pipe coffee bare: true
.pipe es6ModuleTranspiler type: 'cjs'
.pipe gulp.dest './tmp/src'
gulp.task 'copy-js', ->
gulp.src './src/**/*.js'
.pipe es6ModuleTranspiler type: 'cjs'
.pipe gulp.dest './tmp/src'
gulp.task 'test', ['copy-js','compile-scripts'], ->
gulp.src './tmp/src/**/__tests__/*test.js'
.pipe jasmine()
gulp.task 'bundle-scripts', ['compile-scripts'], ->
browserify './tmp/src/app.js'
.bundle standalone: 'app'
.pipe source 'app.js'
.pipe gulp.dest './tmp'
gulp.task 'compile-styles', ->
gulp.src './style/app.sass'
.pipe sass
sourcemap: true
quiet: true
.pipe gulp.dest './tmp'
gulp.task 'copy-public', ->
gulp.src './public/*'
.pipe gulp.dest './tmp'
gulp.task 'dev', ['test', 'bundle-scripts', 'compile-styles', 'copy-public']
gulp.task 'watch', ['dev'], ->
serve('tmp')()
gulp.watch 'style/**/*', ['compile-styles']
gulp.watch 'public/**/*', ['copy-public']
gulp.watch 'src/**/*', ['test', 'bundle-scripts']
gulp.task 'dist', ['bundle-scripts', 'compile-styles', 'copy-public'], ->
gulp.src ['./tmp/*.js', './tmp/*.css', './tmp/*.html']
.pipe gulp.dest './dist'
gitPublish = 'git add . && git commit -m "Updated version" && git push origin gh-pages'
gulp.task 'deploy', ['dist'], shell.task gitPublish, cwd: 'dist'