-
Notifications
You must be signed in to change notification settings - Fork 103
/
Gulpfile.coffee
95 lines (72 loc) · 2.28 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#############################
gulp = require 'gulp'
coffee = require 'gulp-coffee'
cssmin = require 'gulp-cssmin'
concat = require 'gulp-concat'
clean = require 'gulp-clean'
ecstatic = require 'ecstatic'
gutil = require 'gulp-util'
http = require 'http'
sass = require 'gulp-sass'
shell = require 'gulp-shell'
uglify = require 'gulp-uglifyjs'
qunit = require 'node-qunit-phantomjs'
wrapJS = require 'gulp-wrap-js'
#############################
gulp.task 'coffee', ->
gulp
.src 'src/scripts/slick-lightbox.coffee'
.pipe coffee( bare: true ).on('error', gutil.log)
.pipe wrapJS("""'use strict';
(function($) {
%= body %
}(jQuery));""")
.pipe gulp.dest 'dist/'
gulp.task 'sass', ->
gulp
.src 'src/styles/slick-lightbox.sass'
.pipe sass(outputStyle: 'compressed').on('error', sass.logError)
.pipe gulp.dest 'dist/'
#############################
gulp.task 'uglify', ->
gulp
.src 'dist/slick-lightbox.js'
.pipe uglify 'slick-lightbox.min.js', outSourceMap: true
.pipe gulp.dest 'dist/'
gulp.task 'coffeedoc', shell.task(['coffeedoc src/scripts/slick-lightbox.coffee'])
gulp.task 'buildGHPages', shell.task(['jade index.jade'])
#############################
gulp.task 'testClean', ->
gulp
.src './test/tmp'
.pipe clean()
gulp.task 'testCoffee', ['testClean'], ->
gulp
.src ['./test/boilerplate.coffee', './test/tests/*.coffee']
.pipe coffee( bare: true ).on('error', gutil.log)
.pipe gulp.dest('./test/tmp/')
gulp.task 'testConcat', ['testCoffee'], ->
gulp
.src './test/tmp/*.js'
.pipe concat('tests.js')
.pipe gulp.dest('./test/')
gulp.task 'test', ['testConcat', 'base'], ->
qunit './test/test.html', { verbose: true }
#############################
gulp.task 'watch', ->
gulp.watch 'src/scripts/*.coffee', ['coffee', 'coffeedoc']
gulp.watch 'src/styles/*.sass', ['sass']
gulp.watch ['index.jade', 'README.md'], ['buildGHPages']
#############################
gulp.task 'base', ->
gulp.start 'coffee', 'coffeedoc', 'sass', 'uglify'
gulp.task 'build', ->
gulp.start 'base', 'buildGHPages'
gulp.task 'server', ->
gulp.start 'base', 'watch'
http
.createServer ecstatic( root: __dirname )
.listen 9000
#############################
gulp.task 'default', ->
gulp.start 'server'