-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.coffee
80 lines (71 loc) · 2.12 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
'use strict'
gulp = require 'gulp'
plugins = require('gulp-load-plugins')()
coffee = require 'coffee-script'
###
Compress images
###
gulp.task 'images', ->
gulp.src('images/**/*')
.pipe plugins.size()
.pipe(
plugins.cache(
plugins.imagemin
optimizationLevel: 3
progressive: true
interlaced: true
)
)
.pipe gulp.dest 'images/'
.pipe plugins.size()
###
Compile less, and apply vendor prefixes automatically
###
gulp.task 'styles', ->
gulp.src 'assets/stylesheets/*.less'
.pipe plugins.less()
.pipe plugins.autoprefixer 'last 1 version'
.pipe plugins.minifyCss(keepBreaks:true)
.pipe gulp.dest 'css/'
.pipe plugins.size()
###
Compile coffeescript, and concatenate files
###
gulp.task 'scripts', ->
coffeeFilter = plugins.filter '**/*.coffee'
scripts = [
# 'bower_components/jquery/dist/jquery.js'
'bower_components/html5shiv/dist/html5shiv.js'
'assets/javascripts/**/*.*'
]
gulp.src scripts
.pipe coffeeFilter
.pipe plugins.coffee(bare: true).on 'error', plugins.util.log
.pipe coffeeFilter.restore()
.pipe plugins.concat 'main.built.js'
.pipe gulp.dest 'js/'
.pipe plugins.size()
# gulp.src ['bower_components/jquery/dist/jquery.js', 'js/projects/lastfm-favs-to-rdio.js']
# .pipe plugins.concat 'lastfm-favs-to-rdio.built.js'
# .pipe gulp.dest 'js/projects/'
###
Uglify them javascripts!
###
gulp.task 'uglify', ['scripts'], ->
gulp.src 'js/main.built.js'
.pipe plugins.size()
.pipe plugins.uglify()
.pipe plugins.concat 'main.min.js'
.pipe gulp.dest 'js/'
.pipe plugins.size()
# gulp.src 'js/projects/lastfm-favs-to-rdio.built.js'
# .pipe plugins.size()
# .pipe plugins.uglify()
# .pipe plugins.concat 'js/projects/lastfm-favs-to-rdio.min.js'
# .pipe gulp.dest 'js/projects/'
# .pipe plugins.size()
gulp.task 'watch', ['scripts', 'images', 'styles'], ->
gulp.watch 'assets/stylesheets/*.less', ['styles']
gulp.watch 'assets/javascripts/**/*.*', ['scripts']
gulp.watch 'assets/images/**/*.*', ['images']
gulp.task 'build', ['uglify', 'images', 'styles']