mirror of
https://github.com/pure-css/pure.git
synced 2024-12-10 23:44:26 +00:00
20 lines
488 B
JavaScript
20 lines
488 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', e);
|
|
}
|
|
}
|
|
return cache[name];
|
|
},
|
|
getFilePath: function(name) {
|
|
return path.resolve(__dirname, 'build', name);
|
|
}
|
|
};
|