epubjs
Version:
Render ePub documents in the browser, across many devices
113 lines (85 loc) • 4.85 kB
HTML
<html xmlns:epub="http://www.idpf.org/2007/ops" xmlns="http://www.w3.org/1999/xhtml"><head><title>atlas.json</title><link rel="stylesheet" type="text/css" href="epub.css"/></head><body data-type="book"><section data-type="chapter" epub:type="chapter" data-pdf-bookmark="Chapter 8. atlas.json"><div class="chapter" id="atlas-json">
<h1><span class="label">Chapter 8. </span>atlas.json</h1>
<p>The Atlas build system uses a JSON file called <code>atlas.json</code> to save build settings for a particular project. This file lives in the root of each project and is required to trigger a successful build. If this sounds scary to you, don’t worry: Atlas will create this file for you the first time you build, and will write to this file every time you change your build settings in the UI, so you don’t ever have to look at this file if you don’t want to.</p>
<p>But if you’re a more hands-on type, or if you’re going to be building a lot <a data-type="xref" href="ch09.html#atlas-api">Chapter 9</a>, then you can edit <code>atlas.json</code> manually, which makes it possible to change any of your build settings without ever using the UI. The <code>atlas.json</code> file is under version control in your GitHub repo, which means that you can have different settings per branch, or even build your book from any point in your Git history.</p>
<p>The following is a list of attributes you can use.</p>
<h2><span class="label">Chapter 8. </span>Required Fields</h2>
<h3><span class="label">Chapter 8. </span>files</h3>
<p>The only required attribute is <code>files</code>, which is an array listing the files to build in the order you’d like them sequenced in your book. All of these files need to exist in the repository and should be referenced with relative paths from the <code>atlas.json</code> file.</p>
<pre data-original-title="" title="">
{
"files" : ["chapter1.html", "subfolder/chapter2.html"]
}</pre>
<h2><span class="label">Chapter 8. </span>Optional Fields</h2>
<h3><span class="label">Chapter 8. </span>theme</h3>
<p>Use this to specify a theme to use when building the book. This must be the user/organization and project name of the github repo. <a href="#">Lean more about themes</a>.</p>
<pre data-original-title="" title="">
{
"theme" : "oreillymedia/atlas_trade_theme"
}</pre>
<h3><span class="label">Chapter 8. </span>Formats</h3>
<p>The formats objects holds all settings for the different formats. Here’s the basic skeleton. See <a href="#format-options">Format Options</a> for a list of options for the specific formats.</p>
<pre data-original-title="" title="">
{
"formats" : {
"pdf" : {
"option" : "value"
}
}
}</pre>
<h2 id="format-options"><span class="label">Chapter 8. </span>Format Options</h2>
<h3><span class="label">Chapter 8. </span>PDF</h3>
<ul>
<li><code>toc</code> - set to true or false to toggle automatic generation of Table of Contents.</li>
<li><code>index</code> - set to true or false to toggle automatic generation of a book index.</li>
<li><code>version</code> - set to “web” or “print” to generate a PDF for print or digital reading.</li>
</ul>
<p>Here’s an example of what this could look like.</p>
<pre data-original-title="" title="">
{
"formats" : {
"pdf" : {
"toc" : true,
"index" : false,
"version" : "web"
}
}
}</pre>
<h3><span class="label">Chapter 8. </span>EPUB</h3>
<ul>
<li><code>toc</code> - see PDF</li>
<li><code>index</code> - see PDF</li>
<li><code>epubcheck</code> - set to true or false to toggle validation of EPUB against <a href="http://code.google.com/p/epubcheck/">epubcheck</a> and report results.</li>
</ul>
<h3><span class="label">Chapter 8. </span>MOBI</h3>
<ul>
<li><code>toc</code> - see PDF</li>
<li><code>index</code> - see PDF</li>
</ul>
<h3 id="html-format-options"><span class="label">Chapter 8. </span>HTML</h3>
<ul>
<li><code>toc</code> - see PDF</li>
<li><code>index</code> - see PDF</li>
<li><code>javascripts</code> - an array of relative paths to javascript files to be inserted in the <em>layout.html</em> file. Files will be included in the HTML in the order in which they are listed.</li>
<li><code>stylesheets</code> - an array of relative paths to CSS files to be inserted in the <em>layout.html</em> file which will override any theme CSS files. Files will be included in the HTML in the order in which they are listed.</li>
</ul>
<p>Here’s an example of what this could look like.</p>
<pre>
{
"formats" : {
"html": {
"index" : true,
"javascripts" : [
"libraries/jquery.js",
"libraries/underscore.js",
"custom_script.js"
],
"stylesheets" : [
"custom_styles.css"
]
}
}
}
</pre>
</div></section></body></html>