remove cruft, better handle empty config

This commit is contained in:
AJ ONeal 2015-01-14 05:12:12 -05:00
джерело c68e9aaf18
коміт a46178f50f
3 змінених файлів з 27 додано та 10 видалено

@ -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.
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 = {}
```

@ -252,7 +252,17 @@
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';
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)
, themenames = Object.keys(desi.config.themes)
@ -302,17 +312,19 @@
function noErrors(map) {
Object.keys(map).forEach(function (path) {
map[path] = map[path].filter(function (m) {
if (!m.error && m.size) {
return true;
}
if (!m.size) {
console.warn("Ignoring 0 byte file " + (m.path || m.name));
if (m.error) {
console.warn("Couldn't read '" + (m.path || m.name) + "'");
console.warn(m.error);
return false;
}
console.warn("Couldn't get stats for " + (m.path || m.name));
console.warn(m.error);
if (!m.size) {
console.warn("Ignoring 0 byte file '" + (m.path || m.name) + "'");
console.warn(m.error);
return false;
}
return true;
});
});

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