Burn it down and rise from the ashes

This commit is contained in:
Jocelyn Badgley (Twipped)
2020-02-25 19:37:10 -08:00
parent ba8ac1c8e7
commit 97398e6df4
19 changed files with 705 additions and 589 deletions

26
gulp/content/resolve.js Normal file
View File

@@ -0,0 +1,26 @@
const path = require('path');
const ROOT = path.resolve(__dirname, '../..');
const fs = require('fs-extra');
exports.readFile = function readFile (fpath) {
fpath = exports.resolve(fpath);
return fs.readFile(fpath).catch((err) => {
throw new Error(err.trace);
});
};
exports.resolve = function resolve (...args) {
args = args.filter(Boolean);
let fpath = args.shift();
if (!fpath) return ROOT;
if (fpath[0] === '/') throw new Error('Did you mean to resolve this? ' + fpath);
if (fpath[0] === '/') fpath = fpath.slice(1);
return path.resolve(ROOT, fpath, ...args);
};
exports.relative = function relative (fpath) {
return path.relative(ROOT, fpath);
};
exports.ROOT = ROOT;