This is an awesome book. It’s written in AsciiDoc and compiles to HTML, PDF, EPUB using the Asciidoctor Gradle plugin.
npm run setup
If that fails with an error like ./gradlew: Syntax error: word unexpected (expecting "in"), then run the following command to fix the gradlew file:
sed -i.bak 's/\r$//' gradlew
To convert this book to HTML, EPUB, run the following command:
$ npm run build
To convert this book to a 6x9" PDF for printing:
$ generate-pdf.sh
To convert this book to a 8.5x11" PDF for downloading:
$ generate-pdf.sh screen
-
Open build/asciidoc/html5/index.html in your browser to see the generated HTML file.
-
Open build/asciidoc/pdf-prepress/index.pdf to see the 6x9" printable PDF file.
-
Open build/asciidoc/pdf-screen/index.pdf to see the downloadable 8.5x11" PDF file.
-
Open build/asciidoc/epub3/index.epub in iBooks to see the generated EPUB file.
Note
|
To be able to generate the PDF, you need have some dependencies installed. First, install RVM to manage your Ruby installation(s). Once RVM is installed and loaded, run the following commands:
The |
If you’d like a very pleasant authoring experience, the project provides build files that make it possible. First of all,
you’ll need to run gradlew
once. After running it once, you can run ./gradlew watch
to watch for any changes and
recompile files as you save them.
To have a similar awesome experience (watch and auto-reload) in your browser, install Node.js on your machine.
After installing Node, you can run the following command to install development tools (like Browsersync).
You will only need to run this command when dependencies change in package.json
.
npm install
Now you can run the following command:
npm run watch
This will start two daemons:
-
Gradle, which will watch the file system and rebuild the HTML version continuously using AsciiDoctor
-
BrowserSync, which will serve the updated HTML version all of the time and make it available over HTTP
Thanks to this, you’ll have a constantly up to date HTML version available in your browser while editing.