Skip to content

Commit a0aa29d

Browse files
committed
return html in callback, rename keys in default.js
1 parent df845af commit a0aa29d

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

lib/defaults.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,38 @@ var config = {
44
srcToLoad: [
55
{
66
selector: 'img',
7-
attributeName: 'src'
7+
attr: 'src'
88
},
99
{
1010
selector: 'input',
11-
attributeName: 'src'
11+
attr: 'src'
1212
},
1313
{
1414
selector: 'object',
15-
attributeName: 'data'
15+
attr: 'data'
1616
},
1717
{
1818
selector: 'embed',
19-
attributeName: 'src'
19+
attr: 'src'
2020
},
2121
{
2222
selector: 'param[name="movie"]',
23-
attributeName: 'value'
23+
attr: 'value'
2424
},
2525
{
2626
selector: 'script',
27-
attributeName: 'src'
27+
attr: 'src'
2828
},
2929
{
3030
selector: 'link[rel="stylesheet"]',
31-
attributeName: 'href'
31+
attr: 'href'
3232
},
3333
{
3434
selector: 'link[rel*="icon"]',
35-
attributeName: 'href'
35+
attr: 'href'
3636
},
3737
],
38-
staticDirectories: [
38+
directories: [
3939
{
4040
directory: 'images',
4141
extensions: ['.png', '.jpg', '.jpeg', '.gif']

lib/load.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var Loader = function (data) {
2020
options[key] = _.has(options, key) ? options[key] : defaults[key];
2121
});
2222

23-
staticFullPaths = _.map(options.staticDirectories, function (dir) {
23+
staticFullPaths = _.map(options.directories, function (dir) {
2424
return path.resolve(options.path, dir.directory)
2525
});
2626
logger = new Logger(options.log);
@@ -91,7 +91,7 @@ var Loader = function (data) {
9191
* @returns {string}
9292
*/
9393
function getDirectoryByExtension(ext) {
94-
var dirObj = _.chain(options.staticDirectories)
94+
var dirObj = _.chain(options.directories)
9595
.filter(function (dir) {
9696
return _.indexOf(dir.extensions, ext) >= 0
9797
})
@@ -297,18 +297,16 @@ var Loader = function (data) {
297297
// Load all sources
298298
_.each(options.srcToLoad, function (src) {
299299
p = p.then(function (newHtml) {
300-
return loadSources(newHtml, src.selector, src.attributeName)
300+
return loadSources(newHtml, src.selector, src.attr)
301301
});
302302
});
303303

304304
// Save index page
305305
var indexFilePath = path.resolve(options.path, options.indexFile);
306306
p = p.then(function (html) {
307-
return fs.outputFileAsync(indexFilePath, html, {encoding: encoding})
308-
})
309-
.then(function () {
310-
return {status: 'success'}
311-
});
307+
fs.outputFileSync(indexFilePath, html, {encoding: encoding});
308+
return {html: html}
309+
});
312310

313311
return p;
314312
}

0 commit comments

Comments
 (0)