mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
19 lines
481 B
JavaScript
19 lines
481 B
JavaScript
'use strict';
|
|
|
|
var _ = require('lodash'),
|
|
fs = require('fs-extra'),
|
|
glob = require('glob'),
|
|
path = require('path');
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
function globTemplate(pattern) {
|
|
return _.transform(glob.sync(pattern), function(result, filePath) {
|
|
result[path.basename(filePath, path.extname(filePath))] = _.template(fs.readFileSync(filePath));
|
|
}, {});
|
|
}
|
|
|
|
module.exports = {
|
|
'globTemplate': globTemplate
|
|
};
|