diff options
Diffstat (limited to 'lib/generators')
-rw-r--r-- | lib/generators/site.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/generators/site.js b/lib/generators/site.js index 51a6cb3..9b7dbcb 100644 --- a/lib/generators/site.js +++ b/lib/generators/site.js @@ -90,6 +90,7 @@ Generator.prototype.finish = function() { return this.copyAssets() .then(this.copyCover) .then(this.writeGlossary) + .then(this.writeSearchIndex); }; // Normalize a link to .html and convert README -> index @@ -148,6 +149,16 @@ Generator.prototype.writeGlossary = function() { return this._writeTemplate(this.glossaryTemplate, {}, path.join(this.options.output, "GLOSSARY.html")); }; +// Write the search index +Generator.prototype.writeSearchIndex = function() { + var that = this; + + return fs.writeFile( + path.join(this.options.output, "search_index.json"), + JSON.stringify(this.book.searchIndex) + ); +}; + // Convert a page into a normalized data set Generator.prototype.normalizePage = function(page) { var that = this; |