-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
123 lines (108 loc) · 2.79 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
gulp = require 'gulp'
annotate = require 'gulp-ng-annotate'
autoprefixer = require 'gulp-autoprefixer'
bump = require 'gulp-bump'
coffee = require 'gulp-coffee'
concat = require 'gulp-concat'
rename = require 'gulp-rename'
sass = require 'gulp-sass'
svgstore = require 'gulp-svgstore'
svgmin = require 'gulp-svgmin'
symlink = require 'gulp-symlink'
merge = require 'merge-stream'
ngTemplates = require 'gulp-ng-templates'
uglify = require 'gulp-uglify'
htmlmin = require 'gulp-htmlmin'
swallowError = (error) ->
console.error error.toString()
this.emit 'end'
src =
bourbon: './bower_components/bourbon/app/assets/stylesheets'
neat: './bower_components/neat/app/assets/stylesheets'
sass: './sass/master.scss'
allSass: './sass/**/*.scss'
app: './app/**/*.coffee'
templates: [
'./app/templates/**/*.html'
'./images/icons.svg'
]
icons: './images/svg/*.svg'
imagesLink: './images'
dest =
js: './htdocs/js'
css: './htdocs/css'
images: './images'
bourbon: './sass/bourbon'
neat: './sass/neat'
imagesLink: './htdocs/images'
libs = [
'bower_components/angular/angular.js'
'bower_components/angular-animate/angular-animate.js'
'bower_components/angular-resource/angular-resource.js'
'bower_components/angular-ui-router/release/angular-ui-router.js'
'bower_components/jquery/dist/jquery.js'
'bower_components/lodash/lodash.js'
'bower_components/moment/moment.js'
'bower_components/gsap/src/uncompressed/TweenLite.js'
]
gulp.task 'libs', ->
gulp.src libs
.pipe concat 'libs.js'
.pipe gulp.dest dest.js
gulp.task 'build', ['icons'], ->
app = gulp.src src.app
.pipe coffee
bare: true
.on 'error', swallowError
.pipe annotate
singleQuotes: true
.on 'error', swallowError
.pipe concat 'JC.js'
.pipe gulp.dest dest.js
templates = gulp.src src.templates
.pipe htmlmin
collapseWhitespace: true
.pipe ngTemplates 'JC-templates'
.on 'error', swallowError
.pipe concat 'JC.templates.js'
.pipe gulp.dest dest.js
merge app, templates
.pipe concat 'JC.js'
.pipe gulp.dest dest.js
gulp.task 'default', ->
gulp.start 'build'
gulp.start 'sass'
gulp.task 'sass', ->
gulp.src src.sass
.pipe sass
outputStyle: 'compressed'
.on 'error', swallowError
.pipe autoprefixer
browsers: ['last 2 versions']
cascade: false
.on 'error', swallowError
.pipe gulp.dest dest.css
gulp.task 'icons', ->
gulp.src src.icons
.pipe rename
prefix: 'icon-'
.pipe svgmin
js2svg:
pretty: true
.pipe svgstore()
.pipe rename 'icons.svg'
.pipe gulp.dest dest.images
gulp.task 'link', ->
gulp.src src.bourbon
.pipe symlink dest.bourbon,
force: true
gulp.src src.neat
.pipe symlink dest.neat,
force: true
gulp.src src.imagesLink
.pipe symlink dest.imagesLink,
force: true
gulp.task 'watch', ->
gulp.watch src.allSass, ['sass']
gulp.watch [src.app, src.templates[0]], ['build']
gulp.watch src.icons, ['icons']