@@ -331,11 +331,64 @@ RCS.prototype.getWebpackConfig = function () {
331331 {
332332 test : / \. m u s t a c h e $ / ,
333333 loader : 'mustache'
334- } ,
334+ }
335335 ]
336336
337+
338+ //
339+ // var navObj = require('../app/utils/contents');
340+ //
341+ // console.log('NAVOBJ ISSS: ', navObj);
342+ // var categoryArray = navObj.categories.map(function(category) {
343+ // return category
344+ // });
345+ //
346+ // var componentsArray = navObj.categories.map(function(category) {
347+ // return navObj.components[category].map(function(component, j) {
348+ // return category + '/' + component;
349+ // })
350+ // });
351+ //
352+ // console.log('CATEOGRY ARRAY: ', categoryArray);
353+ // console.log('COOOOMPONENT ARRAY: ', componentsArray );
354+ //
355+
356+ function navList ( ) {
357+ var Contents = require ( '../rcs-tmp/component-requires' ) ;
358+ var components = { }
359+ var categories = Contents
360+ . map ( function ( Component ) { return Component . default || Component } )
361+ . map ( function ( Content ) {
362+ const styleguide = Content . styleguide ;
363+ styleguide . category = styleguide . category ? styleguide . category : 'Misc. Component List' ;
364+ components [ styleguide . category ] = components [ styleguide . category ] ? components [ styleguide . category ] : [ ] ;
365+ //IE fix.
366+ styleguide . title = styleguide . title ? styleguide . title : / ^ f u n c t i o n \s + ( [ \w \$ ] + ) \s * \( / . exec ( Content . toString ( ) ) [ 1 ] ;
367+ components [ styleguide . category ] . push ( styleguide . title ) ;
368+
369+ return Content . styleguide . category
370+ } )
371+ . filter ( function ( category , i , categories ) { return categories . indexOf ( category ) === i } ) ;
372+
373+ return {
374+ categories : categories ,
375+ components : components
376+ }
377+ }
378+
379+ var navObj = navList ( ) ;
380+ var componentArray = [ ] ;
381+ var categoryArray = navObj . categories . map ( function ( category ) {
382+ var componentRoute = navObj . components [ category ] . map ( function ( component , j ) {
383+ componentArray . push ( category + '/' + component ) ;
384+ } ) ;
385+
386+ return category ;
387+ } ) ;
388+
389+
337390 var routes = {
338- routes : [ '' , '/Buttons' , '/Buttons/Button' ]
391+ routes : [ '' ] . concat ( categoryArray ) . concat ( componentArray )
339392 } ;
340393
341394 // custom rule for transpiling files
0 commit comments