diff --git a/lib/styleguide.js b/lib/styleguide.js index feb9ecc9..9eddc4d7 100644 --- a/lib/styleguide.js +++ b/lib/styleguide.js @@ -94,6 +94,15 @@ function copyUsedOptionsToJsonConfig(opt, json) { return json; } +function copyUsedOptionsToInlineJsonConfig(opt, json) { + var used = ['title', 'disableEncapsulation', 'disableHtml5Mode']; + json.config = {}; + used.forEach(function(prop) { + json.config[prop] = _.cloneDeep(opt[prop]); + }); + return json; +} + function addFileHashesAndReplaceAbsolutePaths(json) { if (!json) { return; @@ -258,7 +267,7 @@ module.exports.generate = function(options) { .pipe(mustache({ title: opt.title, extraHead: opt.extraHead, - styleguideConfig: JSON.stringify(copyUsedOptionsToJsonConfig(opt, {}).config), + styleguideConfig: JSON.stringify(copyUsedOptionsToInlineJsonConfig(opt, {}).config), appRoot: opt.appRoot, socketIo: opt.server, filesConfig: JSON.stringify(opt.filesConfig) diff --git a/test/integration/structure.test.js b/test/integration/structure.test.js index 417830d3..e4443805 100644 --- a/test/integration/structure.test.js +++ b/test/integration/structure.test.js @@ -64,6 +64,10 @@ describe('index.html', function() { it('should contain serialized styleguide configuration', function() { expect(indexHtml.contents.toString()).to.contain('var _styleguideConfig = {"appRoot":"/my-styleguide-book"'); }); + + it('should not add extraHead to serialized configuration', function() { + expect(indexHtml.contents.toString()).not.to.contain('"extreHead":'); + }); }); describe('styleguide_pseudo_styles.css', function() {