mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-11-25 20:42:40 +00:00
Initial site commit
This commit is contained in:
26
gulp/lib/load.js
Normal file
26
gulp/lib/load.js
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
const through = require('./through');
|
||||
const fs = require('fs-extra');
|
||||
const log = require('fancy-log');
|
||||
const parallelize = require('concurrent-transform');
|
||||
|
||||
module.exports = exports = function load () {
|
||||
return parallelize(through(async (stream, file) => {
|
||||
|
||||
if (file.contents) {
|
||||
// file already has contents, ignore
|
||||
stream.push(file);
|
||||
return;
|
||||
}
|
||||
|
||||
const exists = await fs.pathExists(file.path);
|
||||
// if (!exists) return;
|
||||
|
||||
log('[loading]', file.path, exists);
|
||||
|
||||
file.contents = await fs.readFile(file.path);
|
||||
|
||||
stream.push(file);
|
||||
}), 20);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user