@@ -156,21 +156,6 @@ gulp.task('copy:prod', ['vulcanize:prod'], function() {
156156/** DOCS **/
157157
158158gulp . task ( 'docs' , function ( ) {
159- var modules = glob . sync ( "mm-*" , { cwd :SRC } ) ;
160- var articles = glob . sync ( "*.md" , { cwd :"./docs/articles/" } ) ;
161- var articleMap = JSON . parse ( fs . readFileSync ( './docs/articles/manifest.json' ) ) ;
162-
163- var articleStream = gulp . src ( './docs/articles/*.md' )
164- . pipe ( debug ( ) )
165- . pipe ( marked ( ) . on ( 'error' , console . log ) )
166- . pipe ( wrap ( { src :"./docs/article_template.html" } , { } , { engine :"hogan" } ) . on ( 'error' , console . log ) )
167- . pipe ( gulp . dest ( BUILD_DOCS ) ) ;
168-
169- // return merge(moduleStream, articleStream);
170- return articles ;
171- } ) ;
172-
173- gulp . task ( 'docs:modules' , function ( ) {
174159 function mergeDocArray ( doc , behavior ) {
175160 var p = { } ;
176161 if ( ! behavior ) {
@@ -235,8 +220,9 @@ gulp.task('docs:modules', function() {
235220
236221 var pkg = getPkgInfo ( ) ;
237222
238- // Create moduleList
239- var moduleList = [ ] ;
223+ // Create moduleList from directory listing
224+ var modules = glob . sync ( "mm-*/" , { cwd :SRC } ) ;
225+ var moduleList = modules . map ( function ( name ) { return name . replace ( '/' , '' ) } ) ;
240226
241227 // Create behaviorsMap
242228 var behaviors = glob . sync ( SRC + 'shared/behaviors/*.json' ) ;
@@ -249,13 +235,12 @@ gulp.task('docs:modules', function() {
249235 } ) ;
250236
251237 // Create articleList and articleMap
252- var articleList = [ ] ;
253- var articleMap = { } ;
238+ var articles = glob . sync ( "*.md" , { cwd : "./docs/articles/" } ) ;
239+ var articleMap = JSON . parse ( fs . readFileSync ( './docs/articles/manifest.json' ) ) ;
254240
255- // Finally open the stream
256- gulp . src ( SRC + 'mm-*/doc.json' )
241+ var moduleStream = gulp . src ( SRC + 'mm-*/doc.json' )
257242 . pipe ( injectBehaviorDocs ( behaviorsMap ) )
258- . pipe ( injectDocsMeta ( pkg , moduleList , articleList , articleMap ) )
243+ . pipe ( injectDocsMeta ( pkg , moduleList , articles , articleMap ) )
259244 . pipe ( debug ( ) )
260245 . pipe ( through . obj ( function ( file , enc , cb ) {
261246 var moduleDoc = JSON . parse ( file . contents ) ;
@@ -274,6 +259,14 @@ gulp.task('docs:modules', function() {
274259 } ) )
275260 . pipe ( gulp . dest ( BUILD_DOCS ) )
276261 . on ( 'error' , console . log ) ;
262+
263+ var articleStream = gulp . src ( './docs/articles/*.md' )
264+ . pipe ( debug ( ) )
265+ . pipe ( marked ( ) . on ( 'error' , console . log ) )
266+ . pipe ( wrap ( { src :"./docs/article_template.html" } , { } , { engine :"hogan" } ) . on ( 'error' , console . log ) )
267+ . pipe ( gulp . dest ( BUILD_DOCS ) ) ;
268+
269+ return merge ( moduleStream , articleStream ) ;
277270} ) ;
278271
279272gulp . task ( 'gh-pages' , function ( ) {
0 commit comments