-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.coffee
69 lines (49 loc) · 1.2 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
gulp = require "gulp"
concat = require "gulp-concat"
rename = require "gulp-rename"
minifyHTML = require "gulp-minify-html"
minifyCSS = require "gulp-minify-css"
uncss = require "gulp-uncss"
uglify = require "gulp-uglify"
# HTML
gulpHtmlSrc = "./src/html/index.html"
gulp.task "html", ->
options = {empty: true}
gulp
.src gulpHtmlSrc
.pipe minifyHTML(options)
.pipe gulp.dest("./public")
# CSS
gulpCssSrc = [
"src/css/normalize.css"
"src/css/main.css"
]
gulp.task "css", ->
gulp
.src gulpCssSrc
.pipe concat("all.css")
.pipe uncss({ html: ["./public/index.html"] })
.pipe gulp.dest("./public/css")
.pipe minifyCSS()
.pipe rename("all.min.css")
.pipe gulp.dest("./public/css")
# JS
gulpJsSrc = [
"src/js/vendor/jquery-2.1.0.min.js"
"src/js/webaudiohelpers.js"
"src/js/input.js"
]
gulp.task "js", ->
gulp
.src gulpJsSrc
.pipe concat("all.js")
.pipe gulp.dest("./public/js")
.pipe uglify()
.pipe rename("all.min.js")
.pipe gulp.dest("./public/js")
# Watchers
gulp.task "watch", ->
gulp.watch gulpHtmlSrc, ["html"]
gulp.watch gulpCssSrc, ["css"]
gulp.watch gulpJsSrc, ["js"]
gulp.task "default", ["css", "html", "js", "watch"]