A book about react
HTML builds are handled using docpress, so first install it:
$ npm install -g docpressand then:
$ npm run build:htmlTo boot up a dev server run:
$ npm run start:devCurrently server.js does not use docpress as middleware, which means docpress and the node server will run simultaneously. Docpress will serve up ebook builds from localhost:3000 and the server will serve up the docpress builds from _docpress. This isn't ideal, but it works for now.
The express server simply acts as a permissions layer; if a user is logged out it serves up excerpts, login links etc, but if the user is logged in it serves up a logout link, download links etc. This is accomplished by processing the html using cheerio, it is hacky but works.
To build the other formats first install gitbook-cli and ebook-convert. On OSX that can be done with the following:
$ brew cask install calibre
$ npm install -g gitbook-cliThen to build run:
$ npm run build:$formate.g:
$ npm run build:pdfGitbook can build pdf, epub and mobi
If you want to build all the formats run:
$ npm run buildThe book is meant to be deployed with modulus.io and it is all wrapped up into one command:
$ npm run deployThis will build the html of the book, a new server and client js, and then finally push it to modulus.io
- Fork. it
- Create. a new branch (git checkout -b cat-evolver)
- Commit. your changes (git commit -am 'Add Cat Evolution')
- Test. your changes (always be testing) (you can skip this step for content changes, or if there weren't tests to begin with)
- Push. to the branch (git push origin cat-evolver)
- Pull. Request. (for extra points include funny gif and or pun in comments)
To remember this you can use the easy to remember and totally not tongue-in-check initialism: FCCTPP.
I don't want any of these steps to scare you off. If you don't know how to do something or are struggle getting it to work feel free to create a pull request or issue anyway. I'll be happy to help you get your contributions up to code and into the repo!
Everything in this repo (including the book) is licensed under ISC (basically MIT with less lines). Fork it, quote from it, reuse it, remix etc in any way you like. Just don't claim it as your own. And don't use it to be a jerk towards others.