-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.coffee
65 lines (55 loc) · 1.66 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
gulp = require 'gulp'
coffee = require 'gulp-coffee'
clean = require 'gulp-clean'
karma = require('karma').server
markdown = require 'gulp-markdown'
watch = require 'gulp-watch'
sourcemaps = require 'gulp-sourcemaps'
coffeelint = require 'gulp-coffeelint'
uglify = require 'gulp-uglify'
concat = require 'gulp-concat'
rename = require 'gulp-rename'
gulp.task 'clean', ->
gulp.src ['./.tmp', './dist', './karma_html', 'coverage']
.pipe clean()
gulp.task 'coffee', ['lint', 'clean'], ->
gulp.src './src/*.coffee'
.pipe sourcemaps.init()
.pipe coffee bare: true
.pipe sourcemaps.write()
.pipe gulp.dest './dist/'
gulp.task 'coffeeTest', ['clean'], ->
gulp.src './test/*.coffee'
.pipe sourcemaps.init()
.pipe coffee bare: true
.pipe sourcemaps.write()
.pipe gulp.dest './.tmp/test/'
gulp.task 'minify', ['coffee'], ->
gulp.src './dist/*.js'
.pipe concat 'statr.js'
.pipe gulp.dest './dist/'
.pipe uglify()
.pipe rename 'statr.min.js'
.pipe gulp.dest './dist/'
gulp.task 'lint', [], ->
gulp.src ['./src/*.coffee', './gulpfile.coffee']
.pipe coffeelint()
.pipe coffeelint.reporter()
gulp.task 'test', ['clean', 'coffee', 'coffeeTest'], (done)->
karma.start {
configFile: 'karma.conf.coffee',
singleRun: true
}, done
gulp.task 'doc', ['coffee'], ->
gulp.src './doc/**/*.md'
.pipe markdown
highlight: (code, lang, callback)->
require('pygmentize-bundled')(
{lang: lang, format: 'html'},
code,
(err, result)-> callback err,
result.toString())
.pipe gulp.dest './dist/doc/'
gulp.task 'watchDoc', ->
gulp.watch('./doc/**/*.md', ['doc'])
gulp.task 'default', ['coffee', 'minify', 'test', 'doc']