Skip to content

Commit

Permalink
remove cruft, better handle empty config
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ ONeal committed Jan 14, 2015
1 parent c68e9aa commit a46178f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
7 changes: 7 additions & 0 deletions DESI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
```
Expand Down
22 changes: 17 additions & 5 deletions desirae.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.error) {
console.warn("Couldn't read '" + (m.path || m.name) + "'");
console.warn(m.error);
return false;
}

if (!m.size) {
console.warn("Ignoring 0 byte file " + (m.path || m.name));
console.warn("Ignoring 0 byte file '" + (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);
return true;
});
});

Expand Down
2 changes: 0 additions & 2 deletions lib/deardesi-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,6 @@
});
});

console.info('getAllPartialts', results);
console.info(partials);
return partials;
});
};
Expand Down

0 comments on commit a46178f

Please sign in to comment.