├── .gitignore ├── .npmignore ├── Makefile ├── Readme.md ├── bin ├── bottom.html ├── demobox ├── demobox.js ├── get-config.js ├── render-code.js ├── render-file.js ├── render-utils.js ├── render.js ├── themes.js └── top.html ├── demo.md ├── demo.png ├── index.js ├── less ├── colors.js ├── index.less └── theme.less ├── lib ├── codemirror-rx.js ├── index.js └── jsx.js ├── package.json ├── run.js ├── scripts ├── main-demo.js ├── make-themes.js ├── make-themes.py ├── md-gen.js ├── md-top.md └── theme-demo.js └── www ├── demo.css └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | node_modules 3 | .module-cache 4 | www/demo.html 5 | www/react-demobox.js 6 | /build 7 | /pages 8 | scripts/tmp 9 | themes.md 10 | *.swo 11 | /css 12 | /lib-compiled 13 | /demobox*.tgz 14 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | .module-cache 4 | themes.md 5 | demo.md 6 | /demobox-*.tgz 7 | /build 8 | /node_modules 9 | /pages 10 | /scripts 11 | /www 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | ARGS=-t [ reactify --es6 --everything --visitors jstransform/visitors/es6-destructuring-visitors ] 3 | 4 | js: 5 | browserify ${ARGS} -d run.js -x react -x react/addons -o build/demobox.js 6 | 7 | precompile: less-dist 8 | jsx --harmony lib lib-compiled 9 | 10 | react: 11 | browserify -r react -r react/addons -o build/react.js 12 | 13 | less-dist: 14 | mkdir -p css 15 | lessc less/theme.less css/theme.css 16 | lessc less/index.less css/demobox.css 17 | 18 | less: 19 | lessc less/theme.less build/theme.css 20 | lessc less/index.less build/demobox.css 21 | 22 | colors: 23 | mkdir -p build/themes 24 | cd less && node colors.js 25 | 26 | pages: 27 | mkdir -p pages 28 | rsync build/* -r pages 29 | 30 | gh-pages: pages 31 | cd pages && git add . && git commit -am'update pages' && git push 32 | 33 | # depends on slimerjs 34 | gen-themes: 35 | mkdir -p scripts/tmp 36 | rsync build/* scripts/tmp 37 | node scripts/make-themes.js 38 | python scripts/make-themes.py 39 | mv scripts/tmp/*.png pages/theme_pics 40 | node scripts/md-gen.js 41 | 42 | md-gen: 43 | node scripts/md-gen.js 44 | 45 | gen-demo: 46 | slimerjs scripts/main-demo.js 47 | 48 | index: 49 | ./bin/demobox -i Readme.md -o pages/index.html --no-cdn 50 | 51 | themes: 52 | ./bin/demobox --no-cdn -i themes.md -o pages/themes.html 53 | 54 | demo: 55 | ./bin/demobox --no-cdn -o pages/demo.html 56 | 57 | .PHONY: less js pages css precompile 58 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | ### Demobox is a quick & stylish way of getting a demo page up and running for your new react component. 21 | 22 | There are three ways to use demobox, for varying simplicity and flexibility. 23 | 24 | 1. [demo page generator](#demo-page-generator) -- markdown to demo page converter 25 | 2. [drop-in script](#the-demoboxjs-drop-in-script) -- turn text boxes into live editors 26 | 3. [react component](#as-a-react-component) -- integrate a live editor into your project 27 | 28 | Take a look at the [FAQ](#faq) at the bottom, or head over to 29 | [github](https://github.com/jaredly/demobox/issues) to file an issue or ask a 30 | question. 31 | 32 | # Demo Page Generator 33 | 34 | The `demobox` cli tool will turn a regular markdown file with annotated code 35 | snippets into a stylish demo page with editable examples. You can look at the 36 | markdown source for this page 37 | [here](https://github.com/jaredly/demobox/blob/master/Readme.md) as an 38 | example. Also the source for the demo page 39 | ([demo.md](https://github.com/jaredly/demobox/blob/master/demo.md)) 40 | showcases a number of features. 41 | 42 | ```bash 43 | $ npm install -g demobox 44 | $ demobox -i demo.md -o demo.html 45 | ``` 46 | 47 | ## `demo.md` (||) 48 | 49 | ```markdown 50 | 51 | --- 52 | title: Demobox Demos 53 | subtitle: Getting rather meta 54 | fontPair: Open Sans 55 | colors: light-green 56 | links: 57 | Home: index.html 58 | Demos: demos.html 59 | Themes: themes.html 60 | Github: https://github.com/jaredly/demobox 61 | --- 62 | 63 | # First example 64 | 65 | ``ˋjavascript 66 | // @demobox height=150px 67 | var first = 'javascript code' 68 | , second = `You can evaluate ${first} with es6 goodness.`; 69 | // the last line must be an expression that results in a react 70 | // element. 71 |
72 | {second}
73 | JSX is just fine
74 |