@@ -5,6 +5,7 @@ require! \gulp
5
5
require! \gulp-connect
6
6
require! \gulp-if
7
7
require! \gulp-livescript
8
+ require! \gulp-rename
8
9
require! \gulp-streamify
9
10
require! \gulp-stylus
10
11
require! \gulp-uglify
@@ -18,10 +19,17 @@ require! \watchify
18
19
config =
19
20
minify : process.env.MINIFY == \true
20
21
22
+ # stylus-config :: Boolean -> object
23
+ stylus-config = (minify ) ->
24
+ use : nib!
25
+ import : <[nib]>
26
+ compress : minify
27
+ " include css" : true
28
+
21
29
# build public/components/App.styl which requires other styl files
22
30
gulp .task \build:examples:styles , ->
23
31
gulp .src <[./public/components/App.styl]>
24
- .pipe gulp-stylus { use : nib ! , import : <[nib]> , compress : config .minify , " include css " : true }
32
+ .pipe gulp-stylus (stylus-config config .minify )
25
33
.pipe gulp .dest ' ./public/components'
26
34
.pipe gulp-connect .reload!
27
35
@@ -74,9 +82,8 @@ gulp.task \build-and-watch:examples:scripts, (done) ->
74
82
75
83
gulp .task \build:themes , ->
76
84
gulp .src <[./themes/*.styl]>
77
- .pipe gulp-stylus { use : nib ! , import : <[nib]> , compress : config .minify , " include css " : true }
85
+ .pipe gulp-stylus (stylus-config config .minify )
78
86
.pipe gulp .dest \./themes
79
- .pipe gulp-connect .reload!
80
87
81
88
gulp .task \watch:themes , ->
82
89
gulp .watch <[./themes/*.styl]> , <[build:themes]>
@@ -108,8 +115,22 @@ create-standalone-build = (minify, {file, directory}) ->
108
115
.pipe gulp .dest directory
109
116
110
117
gulp .task \dist , <[build:src:scripts]> , ->
111
- create-standalone-build false , {file : \index.js , directory : \./dist } .on \finish , ->
112
- create-standalone-build true , {file : \index.min.js , directory : \./dist }
118
+ # create dist/index.js
119
+ <- create-standalone-build false , {file : \index.js , directory : \./dist } .on \finish
120
+
121
+ # create dist/index.min.js
122
+ <- create-standalone-build true , {file : \index.min.js , directory : \./dist } .on \finish
123
+
124
+ # create dist/index.css
125
+ gulp .src <[./themes/index.styl]>
126
+ .pipe gulp-stylus (stylus-config false )
127
+ .pipe gulp .dest \./dist
128
+
129
+ # create dist/index.min.css
130
+ gulp .src <[./themes/index.styl]>
131
+ .pipe gulp-stylus (stylus-config true )
132
+ .pipe gulp-rename (path ) -> path.extname = \.min.css
133
+ .pipe gulp .dest \./dist
113
134
114
135
gulp .task \dev:server , ->
115
136
gulp-connect .server do
0 commit comments