-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.coffee
114 lines (86 loc) · 2.06 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
# Reference:
# https://gist.github.com/chriskjaer/8634047
gulp = require 'gulp'
gutil = require 'gulp-util'
jshint = require 'gulp-jshint'
coffee = require 'gulp-coffee'
sass = require 'gulp-sass'
jade = require 'gulp-jade'
concat = require 'gulp-concat'
uglify = require 'gulp-uglify'
rename = require 'gulp-rename'
clean = require 'gulp-clean'
# Script src in index.html
bundle = 'bundle.js'
# Source dir
src = 'src/'
# Distribution dir
dist = 'dist/'
# Vendor scripts
vendor = [
'bower_components/jquery/dist/jquery.min.*'
'bower_components/foundation/js/foundation.min.*'
'bower_components/modernizr/modernizr.js'
]
# Default Task
gulp.task 'default', ['build', 'watch']
gulp.task 'build', [
#'lint'
'css'
'vendor'
'scripts'
'html'
'assets'
]
# Clean distribution dir
gulp.task 'clean', ->
gulp.src dist, read: false
.pipe clean()
# Lint Task
gulp.task 'lint', ->
gulp.src "#{src}/js/*.js"
.pipe jshint()
.pipe jshint.reporter 'default'
# Compile Sass
gulp.task 'css', ->
gulp.src "#{src}styles/*.scss"
.pipe sass
includePaths: ['styles', 'bower_components/foundation/scss', 'bower_components']
errLogToConsole: true
.pipe gulp.dest "#{dist}css"
# Copy vendor scripts
gulp.task 'vendor', ->
gulp.src vendor, read: false
.pipe gulp.dest "#{dist}js/vendor/"
# Compile CoffeeScript
gulp.task 'scripts', ->
gulp.src "#{src}js/*.coffee"
.pipe (coffee
bare: true
).on 'error', gutil.log
.pipe concat bundle
.pipe gulp.dest "#{dist}js"
# Compile Jade
gulp.task 'html', ->
gulp.src "#{src}*.jade"
.pipe jade
pretty: true
.pipe gulp.dest dist
# .pipe livereload server
# Copy images and font folders
gulp.task 'assets', ->
gulp.src ["#{src}images", "#{src}fonts"], read: false
.pipe gulp.dest dist
# gulp.task 'minify', ->
# .pipe rename 'all.min.js'
# .pipe uglify()
# .pipe gulp.dest 'dist'
# Watch files for changes
gulp.task 'watch', ->
gulp.watch "#{src}js/*.coffee", [
#'lint'
'scripts'
]
gulp.watch "#{src}styles/*.scss", ['css']
gulp.watch "#{src}/*.jade", ['html']
return