forked from lu4nik/fivestar
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.coffee
65 lines (54 loc) · 1.33 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
gulp = require 'gulp'
$ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'run-sequence']
});
sources =
sass: 'assets/sass/*.scss'
coffee: [
'assets/coffee/*.coffee'
]
destinations =
css: 'assets/css'
js: 'assets/js'
isProd = $.util.env.type is 'prod'
###
Compile SASS files
###
gulp.task 'style', ->
gulp.src(sources.sass)
.pipe($.sass({compass: true, style: 'expanded'}))
.on('error', $.sass.logError)
.pipe(gulp.dest(destinations.css))
###
Run Coffee files through Coffee Lint
###
gulp.task 'lint', ->
gulp.src(sources.coffee)
.pipe($.coffeelint())
.pipe($.coffeelint.reporter())
###
Compile Coffeescript files
###
gulp.task 'coffee', ->
if isProd
gulp.src(sources.coffee)
.pipe($.coffee({bare: true}).on('error', $.util.log))
.pipe($.concat('fivestar.js'))
.pipe($.uglify())
.pipe(gulp.dest(destinations.js))
else
gulp.src(sources.coffee)
.pipe($.coffee({bare: true}).on('error', $.util.log))
.pipe($.concat('fivestar.js'))
.pipe(gulp.dest(destinations.js))
###
Keep watching files for changes to update them automatically
###
gulp.task 'watch', ->
gulp.watch sources.sass, ['style']
gulp.watch sources.coffee, ['lint', 'coffee']
gulp.task 'build', ['style', 'lint', 'coffee']
###
Default command to run when calling just "gulp"
###
gulp.task 'default', ['watch']