-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
87 lines (75 loc) · 2.27 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
"use strict"
gulp = require "gulp"
coffee = require "gulp-coffee"
concat = require "gulp-concat"
connect = require "gulp-connect"
header = require "gulp-header"
gutil = require "gulp-util"
stylus = require "gulp-stylus"
uglify = require "gulp-uglify"
pkg = require "./package.json"
source =
coffee: [ "source/app.coffee"
"source/app.*.coffee"]
styl : [ "bower_components/STYLmethods/vendor.styl"
"source/styles/__constants__.styl"
"source/styles/flexo.theme.styl"
"source/styles/app.*.styl"]
html : [ "./*.html" ]
dest : "assets/"
thirds =
js :[
"bower_components/jquery/dist/jquery.min.js"
"bower_components/moment/min/moment.min.js"
"bower_components/moment-timezone/builds/moment-timezone-with-data-2010-2020.min.js"]
css :[ "bower_components/flexo/dist/flexo.css"]
fonts :[]
banner = [
"/**"
" * <%= pkg.name %> - <%= pkg.description %>"
" * @version v<%= pkg.version %>"
" * @link <%= pkg.homepage %>"
" * @author <%= pkg.author.name %> (<%= pkg.author.site %>)"
" * @license <%= pkg.license %>"
" */"
""
].join("\n")
gulp.task "webserver", ->
connect.server
port : 8000
livereload: true
gulp.task "thirds", ->
gulp.src thirds.js
.pipe concat "#{pkg.name}.thirds.js"
.pipe gulp.dest "#{source.dest}/js"
.pipe connect.reload()
gulp.src thirds.css
.pipe concat "#{pkg.name}.thirds.css"
.pipe gulp.dest "#{source.dest}/css"
.pipe connect.reload()
gulp.task "coffee", ->
gulp.src source.coffee
.pipe concat "#{pkg.name}.coffee"
.pipe coffee().on "error", gutil.log
.pipe uglify mangle: false
.pipe header banner, pkg: pkg
.pipe gulp.dest "#{source.dest}/js"
.pipe connect.reload()
gulp.task "stylus", ->
gulp.src source.styl
.pipe concat "#{pkg.name}.styl"
.pipe stylus
compress: true
errors : true
.pipe header banner, pkg: pkg
.pipe gulp.dest "#{source.dest}/css"
.pipe connect.reload()
gulp.task "html", ->
gulp.src source.html
.pipe connect.reload()
gulp.task "init", ["thirds", "coffee", "stylus"]
gulp.task "default", ->
gulp.run ["webserver"]
gulp.watch source.coffee, ["coffee"]
gulp.watch source.styl, ["stylus"]
gulp.watch source.html, ["html"]