Skip to content

Commit bee7e33

Browse files
committed
Strip some UI elements to make the docs fit better
Removed navbar on top and to the left.
1 parent 2bb8f26 commit bee7e33

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# clean up previous remains, if any
2+
rm -rf Contents/Resources
3+
rm -rf React.docset
14
mkdir -p Contents/Resources/Documents
25
# create a fresh sqlite db
36
cd Contents/Resources
@@ -10,6 +13,8 @@ wget -m -p -E -k -np http://facebook.github.io/react/
1013
mv facebook.github.io/react ./
1114
rm -rf facebook.github.io
1215
cd ../../../
16+
# change the documentation markup layout a bit to fit dash's small window
17+
node src/modifyDocsHTML.js
1318
# read the previously fetched doc site and parse it into sqlite
1419
node src/index.js
1520
# bundle up!

src/modifyDocsHTML.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
});

0 commit comments

Comments
 (0)