md-toy-blog
Version:
Very simple Markdown blog: serves your md as html without fancy databases. You will only spend time writing the actual data.
22 lines (20 loc) • 834 B
text/typescript
import 'dotenv/config';
import { resolve } from 'path';
import { LoadDictElement } from 'di-why/build/src/DiContainer';
const loadDictElement: LoadDictElement = {
factory: function ({ compiledUserContentDir, pagesDir }: { compiledUserContentDir: string; pagesDir: string; }) {
return function () {
const pageFileAbsPathsList: string[] = require(`${compiledUserContentDir}/page-file-list`);
return pageFileAbsPathsList.map(fullPath => {
const splitRes = fullPath.split(resolve(pagesDir))
const relativePathWithoutPreSlashDotButWithSuffix = splitRes[splitRes.length -1];
return relativePathWithoutPreSlashDotButWithSuffix;
});
};
},
locateDeps: {
compiledUserContentDir: 'MTB_COMPILED_USER_CONTENT_DIR',
pagesDir: 'MTB_PAGES_DIR',
},
};
export default loadDictElement;