forked from shadowfacts/shadowfacts.net
Remove unnecessary blocking generators
This commit is contained in:
parent
2a0f1ab773
commit
f7dea0647f
|
@ -30,9 +30,9 @@ async function generate(theme: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function css() {
|
export default async function css() {
|
||||||
await generate("light");
|
generate("light");
|
||||||
await generate("dark");
|
generate("dark");
|
||||||
await generate("auto");
|
generate("auto");
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
require("fs").watch("site/css/", css);
|
require("fs").watch("site/css/", css);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import css from "./css";
|
||||||
import errors from "./errors";
|
import errors from "./errors";
|
||||||
import homepage from "./homepage";
|
import homepage from "./homepage";
|
||||||
import posts from "./posts";
|
import posts from "./posts";
|
||||||
import rss from "./rss";
|
import * as rss from "./rss";
|
||||||
import tutorials from "./tutorials";
|
import tutorials from "./tutorials";
|
||||||
import years from "./years";
|
import years from "./years";
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,17 @@ async function generateFeed(posts: Page[], permalink: string, category?: string)
|
||||||
util.write(dest, text);
|
util.write(dest, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function rss(posts: Page[], categories: Map<string, Page[]>, tutorials: TutorialSeries[]) {
|
export async function posts(posts: Page[]) {
|
||||||
generateFeed(posts, "/");
|
generateFeed(posts, "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function categories(categories: Map<string, Page[]>) {
|
||||||
categories.forEach((posts, category) => {
|
categories.forEach((posts, category) => {
|
||||||
generateFeed(posts, `/${category}/`, category);
|
generateFeed(posts, `/${category}/`, category);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function tutorials(tutorials: TutorialSeries[]) {
|
||||||
tutorials.forEach(series => {
|
tutorials.forEach(series => {
|
||||||
generateFeed(series.posts, `/tutorials/${series.series}/`, series.seriesName);
|
generateFeed(series.posts, `/tutorials/${series.series}/`, series.seriesName);
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,13 +16,13 @@ async function generate(): Promise<Page[]> {
|
||||||
generators.css();
|
generators.css();
|
||||||
generators.errors();
|
generators.errors();
|
||||||
|
|
||||||
const tutorials = await generators.tutorials();
|
generators.tutorials().then(generators.rss.tutorials);
|
||||||
|
|
||||||
const posts = await generators.posts();
|
const posts = await generators.posts();
|
||||||
generators.homepage(posts);
|
generators.homepage(posts);
|
||||||
generators.years(posts);
|
generators.years(posts);
|
||||||
const categories = await generators.categories(posts);
|
generators.rss.posts(posts)
|
||||||
await generators.rss(posts, categories, tutorials);
|
generators.categories(posts).then(generators.rss.categories);
|
||||||
|
|
||||||
return posts;
|
return posts;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue