1
mirror of https://github.com/pure-css/pure synced 2024-11-22 05:32:20 +01:00
pure/index.js
2016-12-19 22:49:35 -08:00

20 lines
485 B
JavaScript

var fs = require('fs');
var path = require('path');
var 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, 'build', name);
}
};