File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ # clean up previous remains, if any
2
+ rm -rf Contents/Resources
3
+ rm -rf React.docset
1
4
mkdir -p Contents/Resources/Documents
2
5
# create a fresh sqlite db
3
6
cd Contents/Resources
@@ -10,6 +13,8 @@ wget -m -p -E -k -np http://facebook.github.io/react/
10
13
mv facebook.github.io/react ./
11
14
rm -rf facebook.github.io
12
15
cd ../../../
16
+ # change the documentation markup layout a bit to fit dash's small window
17
+ node src/modifyDocsHTML.js
13
18
# read the previously fetched doc site and parse it into sqlite
14
19
node src/index.js
15
20
# bundle up!
Original file line number Diff line number Diff line change
1
+ var cheerio = require ( 'cheerio' ) ;
2
+ var fs = require ( 'fs' ) ;
3
+ var indexedFiles = require ( './indexedFiles' ) ;
4
+
5
+ // remove the left column and the nav bar so that it fits dash's usually small
6
+ // browser screen
7
+ indexedFiles . forEach ( function ( a , i ) {
8
+ var path = __dirname + '/../Contents/Resources/Documents/react/docs/' +
9
+ a . name + '.html' ;
10
+ var src = fs . readFileSync ( path , 'utf8' ) ;
11
+ var $ = cheerio . load ( src ) ;
12
+
13
+ $ ( '.nav-main' ) . remove ( ) ;
14
+ $ ( '.nav-docs' ) . remove ( ) ;
15
+ $ ( '.container' ) . attr ( 'style' , 'min-width:inherit;padding-top:0' ) ;
16
+ $ ( '.wrap' ) . attr ( 'style' , 'width:inherit;' ) ;
17
+ $ ( '.inner-content' ) . attr ( 'style' , 'float:none;margin:auto;' ) ;
18
+ fs . writeFileSync ( path , $ . html ( ) , 'utf8' ) ;
19
+ } ) ;
You can’t perform that action at this time.
0 commit comments