Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philschatz/epub-assembler.js
Assemble an EPUB into a single file
https://github.com/philschatz/epub-assembler.js
Last synced: 5 days ago
JSON representation
Assemble an EPUB into a single file
- Host: GitHub
- URL: https://github.com/philschatz/epub-assembler.js
- Owner: philschatz
- Created: 2014-06-28T19:09:15.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-29T22:39:11.000Z (over 10 years ago)
- Last Synced: 2024-11-19T15:56:43.546Z (2 months ago)
- Language: CoffeeScript
- Size: 203 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Instructions:
There are 2 phases:
1. build an EPUB
1. build a single HTML file## Build an EPUB
1. download [Connexions/rhaptos.cnxmlutils](https://github.com/Connexions/rhaptos.cnxmlutils) and place it in `./`
1. download a complete ZIP from cnx.org
1. unzip it into a directory (`./test-book`)
1. run `sh cnx2epub.sh '[email protected]' ./test-book ./test-epub-dir`## Build a single HTML file
1. `npm install`
1. `node ./src/assembler.js -i ./test-epub-dir > ./single-file.xhtml`You can now run `./single-file.xhtml` through a PDF generation tool to create a PDF.
# Bake the CSS into an HTML file
At this point you can use CSS Polyfills to do things like:
- move the glossaries to the back of the book
- add wrapper elements using `::outside::before::after` for styling features
- add an index
- collate sections/solutions to the end of a chapter
- collate the module abstracts to the start of a chapter (requires more code)Here's how:
Install [philschatz/css-bake.js](https://github.com/philschatz/css-bake.js) globally or use the locally installed version (from `npm install`):
./node_modules/css-bake/bin/css-bake --input-html ./single-file.xhtml --input-css /path/to/css/file.less --output-html ./baked.xhtml --output-css ./baked.css
Now you can run `./baked.html` and `./baked.css` through a PDF-generation tool like `prince`.
## Notes:
1. once we switch to EPUBs for the transforms **Build an EPUB** can be skipped (please do not try to maintain that shell script)