Added support for loading posts

This commit is contained in:
Jocelyn Badgley (Twipped)
2020-02-29 16:27:55 -08:00
parent 56d5f33453
commit 27621e0edd
10 changed files with 216 additions and 88 deletions

16
build/post-asset.js Normal file
View File

@@ -0,0 +1,16 @@
const { without } = require('lodash');
const Asset = require('./asset');
const postmatch = /(\d{4}-\d\d-\d\d)\.\d{4}\.(\w+)/;
module.exports = exports = class PostAsset extends Asset {
_dir (dir) {
dir = dir.replace(postmatch, '$2').split('/');
dir = without(dir, 'posts', '_images');
dir.unshift('p');
return dir;
}
};