bigbuffet-rw/app/soapbox/custom.js

12 lines
338 B
JavaScript
Raw Normal View History

2022-03-03 21:38:59 -08:00
/**
* Functions for dealing with custom build configuration.
*/
/** Require a custom JSON file if it exists */
export const custom = (filename, fallback = {}) => {
const context = require.context('custom', false, /\.json$/);
const path = `./${filename}.json`;
return context.keys().includes(path) ? context(path) : fallback;
};