mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-02-07 10:16:16 +00:00
Pages only task for faster iterative builds
This commit is contained in:
parent
8f4a862e8e
commit
1d4501d41a
@ -82,6 +82,37 @@ exports.everything = function (prod = false) {
|
|||||||
return fn;
|
return fn;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.posts = function () {
|
||||||
|
async function fn () {
|
||||||
|
const prod = false;
|
||||||
|
// load a directory scan of the public and post folders
|
||||||
|
const [ PublicFiles, PostFiles ] = await Promise.all([
|
||||||
|
loadPublicFiles(),
|
||||||
|
loadPostFiles(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// load data for all the files in that folder
|
||||||
|
await Promise.map(PublicFiles.assets, (p) => p.load());
|
||||||
|
await Promise.map(PublicFiles.pages, (p) => p.load(PublicFiles));
|
||||||
|
|
||||||
|
await Promise.map(PostFiles.assets, (p) => p.load());
|
||||||
|
await Promise.map(PostFiles.pages, (p) => p.load(PostFiles));
|
||||||
|
|
||||||
|
// prime tweet data for all pages
|
||||||
|
const pages = await primeTweets(PublicFiles.pages.filter((p) => !p.meta.ignore));
|
||||||
|
|
||||||
|
let posts = await primeTweets(PostFiles.pages.filter((p) => !p.meta.ignore));
|
||||||
|
posts = sortBy(posts, 'date');
|
||||||
|
posts.reverse();
|
||||||
|
|
||||||
|
const engines = await getEngines(prod);
|
||||||
|
const postIndex = await pageWriter(prod, engines, pages, posts);
|
||||||
|
await fs.writeFile(resolve('dist/tweets/index.json'), prod ? JSON.stringify(postIndex) : JSON.stringify(postIndex, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn.displayName = 'buildPages';
|
||||||
|
return fn;
|
||||||
|
};
|
||||||
|
|
||||||
exports.task = function (action, prod = false) {
|
exports.task = function (action, prod = false) {
|
||||||
const fn = async () => {
|
const fn = async () => {
|
||||||
|
@ -7,6 +7,8 @@ var build = require('../build');
|
|||||||
|
|
||||||
const devBuildTask = build.everything();
|
const devBuildTask = build.everything();
|
||||||
const prodBuildTask = build.everything(true);
|
const prodBuildTask = build.everything(true);
|
||||||
|
const pagesTask = build.pages();
|
||||||
|
exports.pages = () => pagesTask();
|
||||||
|
|
||||||
const scss = exports.scss = build.task('scss');
|
const scss = exports.scss = build.task('scss');
|
||||||
const favicon = exports.favicon = build.task('favicon');
|
const favicon = exports.favicon = build.task('favicon');
|
||||||
@ -41,10 +43,10 @@ exports.testpush = pushToProd.dryrun;
|
|||||||
function watcher () {
|
function watcher () {
|
||||||
|
|
||||||
watch([
|
watch([
|
||||||
'public/**/*',
|
'public/**/*.{md,hbs,html}',
|
||||||
'posts/**/*',
|
'posts/**/*.{md,hbs,html}',
|
||||||
'templates/*.{md,hbs,html}',
|
'templates/*.{md,hbs,html}',
|
||||||
], devBuildTask);
|
], pagesTask);
|
||||||
|
|
||||||
watch([
|
watch([
|
||||||
'scss/*.scss',
|
'scss/*.scss',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user