sterling-css
Version:
A set of small CSS components suitable for any project.
21 lines (18 loc) • 433 B
JavaScript
const fs = require('fs');
const path = require('path');
const cache = {};
module.exports = {
getFile: function(name) {
if (!cache[name]) {
try {
cache[name] = fs.readFileSync(this.getFilePath(name), 'utf-8');
} catch(e) {
throw new Error(name + ' does not exist');
}
}
return cache[name];
},
getFilePath: function(name) {
return path.resolve(__dirname, 'dist', name);
}
};