remove cruft, better handle empty config

This commit is contained in:
AJ ONeal 2015-01-14 05:12:12 -05:00
parent c68e9aaf18
commit a46178f50f
3 changed files with 27 additions and 10 deletions

View File

@ -5,6 +5,13 @@ Every template gets an object with the exact same structure - whether it's a tem
Here we only document Desirae's default behavior, but there are many objects added for compatibility with Ruhoh that are not documented. Here we only document Desirae's default behavior, but there are many objects added for compatibility with Ruhoh that are not documented.
config.yml vs site.yml
------
site.yml is for anything that changes the content of the site (navigation, title, analytic and ad ids, default author, etc)
config.yml is for anything that doesn't change the site (from where to read directories, which order to load plugins)
``` ```
desi = {} desi = {}
``` ```

View File

@ -252,7 +252,17 @@
desi[key] = clone(arr[key]); desi[key] = clone(arr[key]);
}); });
// TODO just walk all of ./*.yml authors, posts, themes, _root from the get-go
desi.config.rootdir = desi.config.rootdir || '_root'; desi.config.rootdir = desi.config.rootdir || '_root';
if ('object' !== typeof desi.config.collections || !Object.keys(desi.config.collections).length) {
desi.config.collections = { 'posts': {} };
}
if ('object' !== typeof desi.config.themes || !Object.keys(desi.config.themes).length) {
desi.config.themes = { 'default': 'twitter', 'twitter': {} };
}
if ('object' !== typeof desi.config.assets || !Object.keys(desi.config.assets).length) {
desi.config.assets = { 'media': {} };
}
var collectionnames = Object.keys(desi.config.collections) var collectionnames = Object.keys(desi.config.collections)
, themenames = Object.keys(desi.config.themes) , themenames = Object.keys(desi.config.themes)
@ -302,17 +312,19 @@
function noErrors(map) { function noErrors(map) {
Object.keys(map).forEach(function (path) { Object.keys(map).forEach(function (path) {
map[path] = map[path].filter(function (m) { map[path] = map[path].filter(function (m) {
if (!m.error && m.size) { if (m.error) {
return true; console.warn("Couldn't read '" + (m.path || m.name) + "'");
} console.warn(m.error);
if (!m.size) {
console.warn("Ignoring 0 byte file " + (m.path || m.name));
return false; return false;
} }
console.warn("Couldn't get stats for " + (m.path || m.name)); if (!m.size) {
console.warn(m.error); console.warn("Ignoring 0 byte file '" + (m.path || m.name) + "'");
console.warn(m.error);
return false;
}
return true;
}); });
}); });

View File

@ -312,8 +312,6 @@
}); });
}); });
console.info('getAllPartialts', results);
console.info(partials);
return partials; return partials;
}); });
}; };