@@ -29,6 +29,18 @@ module.exports = function () {
2929
3030 var template = fs . readFileSync ( 'src/templates/components.html' , 'utf8' )
3131
32+ var componentsForNav = { }
33+ components . map ( function ( component ) {
34+ var componentTokens = component . replace ( 'src/components/' , '' ) . split ( '/' )
35+ var category = componentTokens [ 0 ]
36+
37+ componentsForNav [ category ] = componentsForNav [ category ] || [ ]
38+ componentsForNav [ category ] . push ( {
39+ href : component . replace ( 'src' , '' ) . replace ( '.html' , '' ) + '/index.html' ,
40+ name : getTitle ( component )
41+ } )
42+ } )
43+
3244 components . forEach ( function ( component ) {
3345 var newDir = rmHtmlExt ( component . replace ( 'src/' , '' ) )
3446 var newFile = newDir + '/index.html'
@@ -47,6 +59,7 @@ module.exports = function () {
4759 frontMatter . footer = fs . readFileSync ( 'src/templates/footer.html' , 'utf8' )
4860 frontMatter . analytics = fs . readFileSync ( 'src/templates/ga.html' , 'utf8' )
4961 frontMatter . head = fs . readFileSync ( 'src/templates/head.html' , 'utf8' )
62+ frontMatter . componentsForNav = componentsForNav
5063
5164 var moduleSrcs = { }
5265 var getModules = postcss . plugin ( 'get-modules' , function ( ) {
0 commit comments