Site JS is now compiled inside of content. No more gulp streams.

This commit is contained in:
Jocelyn Badgley (Twipped)
2020-02-28 10:27:52 -08:00
parent 695637c3e7
commit 823f662743
13 changed files with 105 additions and 633 deletions

View File

@@ -12,6 +12,8 @@ const { resolve } = require('./resolve');
const favicon = require('./favicon');
const scss = require('./scss');
const svg = require('./svg');
const scripts = require('./scripts');
exports.everything = function (prod = false) {
const fn = async () => {
@@ -30,23 +32,20 @@ exports.everything = function (prod = false) {
const tasks = await Promise.all([
PublicFiles.tasks,
scss(prod),
scripts(prod),
svg(prod),
favicon(prod),
]);
async function crankTasks () {
if (!tasks.length) return;
const cache = new Cache({ prod });
await cache.load();
await evaluate(tasks.flat(), cache);
await cache.save();
}
await fs.writeFile(resolve('pages.json'), JSON.stringify(pages.map((p) => p.toJson()), null, 2));
await Promise.all([
fs.writeFile(resolve('pages.json'), JSON.stringify(pages.map((p) => p.toJson()), null, 2)),
pageWriter(pages, prod),
crankTasks(),
]);
await fs.ensureDir(resolve('dist'));
const cache = new Cache({ prod });
await cache.load();
await evaluate(tasks.flat(), cache);
await cache.save();
await pageWriter(pages, prod);
};
const ret = () => fn().catch((err) => { console.log(err.trace || err); throw err; });