-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.coffee
97 lines (79 loc) · 2.46 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
gulp = require 'gulp'
gutil = require 'gulp-util'
uglify = require 'gulp-uglify'
coffee = require 'gulp-coffee'
watch = require 'gulp-watch'
concat = require 'gulp-concat'
imagemin = require 'gulp-imagemin'
rimraf = require 'gulp-rimraf'
flatten = require 'gulp-flatten'
minifycss = require 'gulp-minify-css'
size = require 'gulp-size'
path =
scripts: 'app/scripts/**/*.coffee'
styles: 'app/styles/**/*.css'
bower: 'app/components'
html: 'app/html/**/*.html'
assets: 'app/assets/*'
gulp.task 'scripts', () ->
gulp.src(path.scripts)
.pipe(coffee({bare: true}).on 'error', gutil.log)
.pipe(concat 'app.min.js')
.pipe(size())
.pipe(gulp.dest '_public/js')
gulp.task 'uglyscripts', () ->
gulp.src(path.scripts)
.pipe(coffee({bare: true}).on 'error', gutil.log)
.pipe(concat 'app.min.js')
.pipe(uglify())
.pipe(size())
.pipe(gulp.dest '_public/js')
gulp.task 'styles', () ->
gulp.src(path.styles)
.pipe(concat 'app.min.css')
.pipe(minifycss())
.pipe(size())
.pipe(gulp.dest '_public/css')
gulp.task 'jquery', () ->
gulp.src('app/components/jquery/jquery.min.js')
.pipe(size())
.pipe(gulp.dest('_public/js'))
gulp.task 'bowerjs', () ->
gulp.src('app/components/**/*.min.js', !'app/components/jquery/jquery.min.js')
.pipe(flatten())
.pipe(concat 'vendor.min.js')
.pipe(size())
.pipe(gulp.dest('_public/js'))
gulp.task 'bowercss', () ->
gulp.src('app/components/**/*.min.css')
.pipe(flatten())
.pipe(concat 'vendor.min.css')
.pipe(size())
.pipe(gulp.dest('_public/css'))
gulp.task 'html', () ->
gulp.src(path.html)
.pipe(size())
.pipe(gulp.dest '_public')
gulp.task 'assets', () ->
gulp.src(path.assets)
.pipe(imagemin({optimizationLevel: 5}))
.pipe(size())
.pipe(gulp.dest '_public/assets')
gulp.task 'ngroute', () ->
gulp.src('app/components/angular-route/angular-route.min.js')
.pipe(flatten())
.pipe(concat 'ngroute.min.js')
.pipe(size())
.pipe(gulp.dest('_public/js'))
gulp.task 'watch', () ->
gulp.watch path.scripts, ['scripts']
gulp.watch path.styles, ['styles']
gulp.watch path.bower, ['bowerjs']
gulp.watch path.html, ['html']
gulp.watch path.assets, ['assets']
gulp.task 'clean', () ->
gulp.src('_public', { read: false })
.pipe(rimraf())
gulp.task 'default', ['styles', 'html', 'jquery', 'bowerjs', 'bowercss', 'assets', 'ngroute']
gulp.task 'dev', ['default', 'scripts', 'watch']
gulp.task 'build', ['clean', 'default', 'uglyscripts']