Skip to content

Commit cf1b30f

Browse files
committed
makes sure html.dependencies works
1 parent cdf9344 commit cf1b30f

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

bit-docs.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ var mergeOnto = function(prop, dest, source){
2727
* This plugin registers onto these hooks:
2828
* - `tags`
2929
* - `generator`
30-
*
30+
*
3131
* Registering the `tags` hook adds the `@templaterender` tag.
32-
*
32+
*
3333
* Registering the `generator` hook makes it so this plugin can generate the
3434
* HTML output from the provided [bit-docs/types/docMap]. The entry point for
3535
* this generator is [bit-docs-generate-html/html].
36-
*
36+
*
3737
* This plugin handles the `html` hook, which allows other plugins to hook into
3838
* the generation process, to do things like include their own static assets,
3939
* or provide their own mustache templates.
40-
*
40+
*
4141
* This plugin provides a default set of mustache templates and static assets.
4242
* These mustache templates and less styles can be copied over into a theme
4343
* plugin and customized. Any custom mustache template will override a default
@@ -50,13 +50,14 @@ module.exports = function(bitDocs){
5050

5151
bitDocs.handle("html", function(siteConfig, htmlConfig) {
5252
if(!siteConfig.html) {
53-
siteConfig.html = {
53+
siteConfig.html = {};
54+
}
55+
_.defaultsDeep(siteConfig.html, {
5456
dependencies: {},
5557
static: [],
5658
templates: [],
5759
staticDist: []
58-
};
59-
}
60+
});
6061
var html = siteConfig.html;
6162
_.assign(html.dependencies, htmlConfig.dependencies || {});
6263
mergeOnto("staticDist", html, htmlConfig);

html_test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var rimraf = require('rimraf');
77
var html = require("./html");
88
var rmdir = Q.denodeify(rimraf);
99
var readFile = Q.denodeify(fs.readFile);
10+
var bitDocsHTML = require("./bit-docs");
1011

1112
require("./build/build_test");
1213

@@ -274,4 +275,16 @@ describe("bit-docs-generate-html", function(){
274275
assert.ok( (""+data).indexOf('href="index.html"') !== -1, "link to earth as index" );
275276
});
276277
});
278+
279+
it("doesn't blow away html values", function(){
280+
bitDocsHTML({
281+
register: function(){},
282+
handle: function(name, fn) {
283+
var siteConfig = {html : {templates: "foo"}};
284+
fn(siteConfig, {});
285+
286+
assert.ok(typeof siteConfig.html.dependencies === "object", "is an object")
287+
}
288+
});
289+
})
277290
});

0 commit comments

Comments
 (0)