1
1
!function exportedTasksDefinedBeginsHere
2
2
gulp .task ' client' <[ client:html client:css client:js ]> ! (done ) ->
3
3
if config .env .is ' production'
4
- gulp .start ' client:html' done
4
+ gulp .start ' client:html' .on ' task_stop' ! (event ) ->
5
+ done! if event .task is ' client:html'
5
6
else
6
7
livereload .listen config .port .livereload , done
7
8
@@ -16,28 +17,27 @@ require! {
16
17
path
17
18
}
18
19
require! {
20
+ hljs : ' highlight.js'
19
21
gulp
22
+ ' gulp-livescript'
23
+ ' gulp-uglify'
24
+ ' gulp-angular-templatecache'
20
25
' gulp-jade'
21
- ' gulp-ruby- sass'
26
+ ' gulp-sass'
22
27
' gulp-minify-css'
23
- ' gulp-angular-templatecache'
24
- ' gulp-uglify'
25
- ' gulp-livescript'
26
28
' gulp-concat'
27
- ' gulp-livereload'
28
29
' gulp-rev'
29
30
}
30
31
require! {
31
- hljs : ' highlight.js'
32
- ' tiny-lr'
33
- ' connect-livereload'
34
- }
35
- require! {
36
- ' ../lib/gulpfile'
37
32
' ../config'
33
+ ' ../lib/gulpfile'
38
34
}
39
-
40
- const livereload = tiny-lr!
35
+ unless config .env .is ' production'
36
+ require! {
37
+ ' tiny-lr'
38
+ ' gulp-livereload'
39
+ }
40
+ const livereload = tiny-lr!
41
41
42
42
function identity
43
43
it
@@ -57,7 +57,10 @@ function prependTimestampFactory (filepath)
57
57
*/
58
58
gulp .task ' client:html:partials' ->
59
59
return gulp .src ' client/views/partials/*.jade'
60
- .pipe gulp-jade pretty : true
60
+ # {doctype: 'html'} https://github.com/visionmedia/jade/issues/1180#issuecomment-40351567
61
+ .pipe gulp-jade do
62
+ pretty : true
63
+ doctype : ' html'
61
64
.pipe gulp .dest ' tmp/.html-cache/partials'
62
65
63
66
gulp .task ' client:js:partials' ->
@@ -66,29 +69,30 @@ gulp.task 'client:js:partials' ->
66
69
.pipe gulp .dest ' tmp/.js-cache/partials'
67
70
68
71
gulp .task ' client:html' <[ client:html:partials client:js:partials ]> ->
69
- return gulp .src ' client/views/*.jade'
72
+ stream = gulp .src ' client/views/*.jade'
70
73
.pipe gulp-jade do
71
74
pretty : ! config .env .is ' production'
75
+ doctype : ' html'
72
76
locals :
73
77
highlight : ->
74
78
hljs .highlight do
75
79
path .extname it .substr 1
76
80
fs .readFileSync it , ' utf8'
77
81
.value
78
- javascriptIncludeTag : prependTimestampFactory ' ./tmp/js-manifest/rev-manifest.json'
79
- stylesheetLinkTag : prependTimestampFactory ' ./tmp/css-manifest/rev-manifest.json'
82
+ javascriptIncludeTag : prependTimestampFactory ' ./tmp/. js-manifest/rev-manifest.json'
83
+ stylesheetLinkTag : prependTimestampFactory ' ./tmp/. css-manifest/rev-manifest.json'
80
84
81
85
.pipe gulp .dest ' tmp/public'
82
- .pipe gulp-livereload(livereload )
86
+ stream. = pipe gulp-livereload(livereload ) unless config .env .is ' production'
87
+ return stream
83
88
84
89
gulp .task ' client:css:scss' ->
85
90
return gulp .src ' client/stylesheets/application.scss'
86
- .pipe gulp-ruby- sass do
87
- loadPath : [
91
+ .pipe gulp-sass do
92
+ includePaths : [
88
93
path .join ... <[ bower_components twbs-bootstrap-sass vendor assets stylesheets ]>
89
94
]
90
- cacheLocation : ' tmp/.sass-cache'
91
- style : if config .env .is ' production' then ' compressed' else ' nested'
95
+ outputStyle : if config .env .is ' production' then ' compressed' else ' nested'
92
96
.pipe gulp .dest ' tmp/.css-cache'
93
97
94
98
gulp .task ' client:css:bower_components' ->
@@ -101,20 +105,25 @@ gulp.task 'client:css:bower_components' ->
101
105
gulp .task ' client:css' <[ client:css:scss client:css:bower_components ]> ->
102
106
stream = gulp .src ' tmp/.css-cache/*.css'
103
107
.pipe gulp-concat ' application.css'
104
- stream. = pipe gulp-rev! if config .env .is ' production'
108
+ if config .env .is ' production'
109
+ stream. = pipe gulp-minify-css!
110
+ .pipe gulp-rev!
105
111
stream. = pipe gulp .dest ' tmp/public'
106
- .pipe gulp-livereload(livereload )
107
112
if config .env .is ' production'
108
113
stream. = pipe gulp-rev .manifest!
109
- .pipe gulp .dest ' tmp/css-manifest'
114
+ .pipe gulp .dest ' tmp/.css-manifest'
115
+ else
116
+ stream. = pipe gulp-livereload(livereload )
110
117
return stream
111
118
112
119
gulp .task ' client:templates' ->
113
120
stream = gulp .src ' client/templates/**/*.jade'
114
- .pipe gulp-jade pretty : ! config .env .is ' production'
121
+ .pipe gulp-jade do
122
+ pretty : ! config .env .is ' production'
123
+ doctype : ' html'
115
124
.pipe gulp-angular-templatecache do
116
125
root : ' /'
117
- module : ' tc-spa-boilerplate .templates'
126
+ module : ' application .templates'
118
127
standalone : true
119
128
stream. = pipe gulp-uglify! if config .env .is ' production'
120
129
return stream .pipe gulp .dest ' tmp/.js-cache'
@@ -130,10 +139,11 @@ gulp.task 'client:js:ls' ->
130
139
return stream .pipe gulp .dest ' tmp/.js-cache'
131
140
132
141
gulp .task ' client:js:bower_components' ->
133
- # stream = gulp.src [
134
- # ]
135
- # stream.=pipe gulp-uglify! if config.env.is 'production'
136
- # return stream.pipe gulp.dest 'tmp/.js-cache'
142
+ stream = gulp .src [
143
+ ' bower_components/angular-ga/ga.js'
144
+ ]
145
+ stream. = pipe gulp-uglify! if config .env .is ' production'
146
+ return stream .pipe gulp .dest ' tmp/.js-cache'
137
147
138
148
gulp .task ' client:js' <[ lib:js client:templates client:js:ls client:js:bower_components ]> ->
139
149
stream = gulp .src [
@@ -144,10 +154,11 @@ gulp.task 'client:js' <[ lib:js client:templates client:js:ls client:js:bower_co
144
154
.pipe gulp-concat ' application.js'
145
155
stream. = pipe gulp-rev! if config .env .is ' production'
146
156
stream. = pipe gulp .dest ' tmp/public'
147
- .pipe gulp-livereload(livereload )
148
157
if config .env .is ' production'
149
158
stream. = pipe gulp-rev .manifest!
150
- .pipe gulp .dest ' tmp/js-manifest'
159
+ .pipe gulp .dest ' tmp/.js-manifest'
160
+ else
161
+ stream. = pipe gulp-livereload(livereload )
151
162
return stream
152
163
# define!
153
164
exportedTasksDefinedBeginsHere!
0 commit comments