@@ -2,7 +2,7 @@ var fs = require('fs');
22var path = require ( 'path' ) ;
33
44var sourceFiles = require ( '../../utils/source-files' ) ;
5- var fileSizes = getJSON ( '../../utils/ file-sizes.json ' ) ;
5+ var fileSizes = getJSON ( 'file-sizes' ) ;
66
77var root = { title : 'Base' , children : [ ] } ;
88var effects = { title : 'Effects' , children : [ ] } ;
@@ -13,12 +13,12 @@ var extras = { title: 'Extras', children: [] };
1313var sidebarForDocs = [ root , effects , renderers , shapes , extras ] ;
1414
1515for ( var i = 0 ; i < sourceFiles . length ; i ++ ) {
16-
1716 // var name = sourceFiles[i].replace(/.*\/([a-zA-Z\-]*)\.js$/i, '$1');
1817 var name = sourceFiles [ i ]
1918 . replace ( 'jsm/' , '' )
2019 . replace ( 'extras' , '/extras' )
21- . replace ( 'src/' , '/' ) . replace ( '.js' , '/' ) ;
20+ . replace ( 'src/' , '/' )
21+ . replace ( '.js' , '/' ) ;
2222
2323 name = `/docs${ name } ` ;
2424
@@ -33,30 +33,71 @@ for (var i = 0; i < sourceFiles.length; i++) {
3333 } else {
3434 root . children . push ( name ) ;
3535 }
36-
3736}
3837
39- function getJSON ( filepath ) {
40- var file = fs . readFileSync ( path . resolve ( __dirname , filepath ) ) ;
38+ function getJSON ( filename ) {
39+ var file = fs . readFileSync (
40+ path . resolve ( __dirname , '../../utils/' , `${ filename } .json` )
41+ ) ;
4142 return JSON . parse ( file ) ;
4243}
4344
4445module . exports = {
4546 head : [
4647 [ 'link' , { rel : 'icon' , href : '/images/favicon.gif' } ] ,
47- [ 'link' , { rel : 'stylesheet' , href : 'https://use.typekit.net/edp1hux.css' } ] ,
48- [ 'meta' , { name : 'google-site-verification' , content : 'eNzLpThZ5XFyxVRedxqW7JxwibqK83DLO-Pqx9rTIDo' } ] ,
48+ [
49+ 'link' ,
50+ { rel : 'stylesheet' , href : 'https://use.typekit.net/edp1hux.css' } ,
51+ ] ,
52+ [
53+ 'meta' ,
54+ {
55+ name : 'google-site-verification' ,
56+ content : 'eNzLpThZ5XFyxVRedxqW7JxwibqK83DLO-Pqx9rTIDo' ,
57+ } ,
58+ ] ,
4959 [ 'meta' , { property : 'og:title' , content : 'Two.js' } ] ,
50- [ 'meta' , { property : 'og:description' , content : 'A renderer agnostic two-dimensional drawing api for the web.' } ] ,
60+ [
61+ 'meta' ,
62+ {
63+ property : 'og:description' ,
64+ content : 'A renderer agnostic two-dimensional drawing api for the web.' ,
65+ } ,
66+ ] ,
5167 [ 'meta' , { property : 'og:url' , content : 'https://two.js.org/' } ] ,
5268 [ 'meta' , { property : 'og:type' , content : 'website' } ] ,
53- [ 'meta' , { property : 'og:image' , content : 'https://two.js.org/images/thumbnail.jpg' } ] ,
69+ [
70+ 'meta' ,
71+ {
72+ property : 'og:image' ,
73+ content : 'https://two.js.org/images/thumbnail.jpg' ,
74+ } ,
75+ ] ,
5476 [ 'meta' , { name : 'twitter:card' , content : 'summary' } ] ,
5577 [ 'meta' , { name : 'twitter:site' , content : '@jonofyi' } ] ,
5678 [ 'meta' , { name : 'twitter:title' , content : 'Two.js' } ] ,
57- [ 'meta' , { name : 'twitter:description' , content : 'A renderer agnostic two-dimensional drawing api for the web.' } ] ,
58- [ 'meta' , { name : 'twitter:image' , content : 'https://two.js.org/images/thumbnail.jpg' } ] ,
59- [ 'script' , { type : 'text/javascript' , src : 'https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.0/beautify.min.js' , async : '' } ]
79+ [
80+ 'meta' ,
81+ {
82+ name : 'twitter:description' ,
83+ content : 'A renderer agnostic two-dimensional drawing api for the web.' ,
84+ } ,
85+ ] ,
86+ [
87+ 'meta' ,
88+ {
89+ name : 'twitter:image' ,
90+ content : 'https://two.js.org/images/thumbnail.jpg' ,
91+ } ,
92+ ] ,
93+ [
94+ 'script' ,
95+ {
96+ type : 'text/javascript' ,
97+ src : 'https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.0/beautify.min.js' ,
98+ async : '' ,
99+ } ,
100+ ] ,
60101 ] ,
61102 description : 'A renderer agnostic two-dimensional drawing api for the web.' ,
62103 themeConfig : {
@@ -76,21 +117,24 @@ module.exports = {
76117 productionSize : fileSizes . production ,
77118 nav : [
78119 {
79- text : 'Docs' , link : '/docs/two/'
120+ text : 'Docs' ,
121+ link : '/docs/two/' ,
80122 } ,
81123 {
82- text : 'Examples' , link : '/examples/'
124+ text : 'Examples' ,
125+ link : '/examples/' ,
83126 } ,
84127 {
85- text : 'Changelog' , link : '/changelog/'
86- }
128+ text : 'Changelog' ,
129+ link : '/changelog/' ,
130+ } ,
87131 ] ,
88132 sidebar : {
89133 '/changelog/' : [ '/changelog/' ] ,
90- '/docs/' : sidebarForDocs
134+ '/docs/' : sidebarForDocs ,
91135 } ,
92136 markdown : {
93- lineNumbers : true
94- }
95- }
137+ lineNumbers : true ,
138+ } ,
139+ } ,
96140} ;
0 commit comments