Permalink
Browse files

allow for regex by using options

  • Loading branch information...
1 parent eec7f69 commit c0bd976ef090b6fcc2e633f5d004ae7953cbe93f @jdcataldo jdcataldo committed May 31, 2016
Showing with 5 additions and 4 deletions.
  1. +5 −4 index.js
View
@@ -3,15 +3,16 @@ var loaderUtils = require('loader-utils');
module.exports = function(source) {
this.cacheable && this.cacheable();
- var options = loaderUtils.parseQuery(this.query);
+ var query = loaderUtils.parseQuery(this.query);
+ var options = this.options.ejsLoader || {};
['escape', 'interpolate', 'evaluate'].forEach(function(templateSetting) {
- var setting = options[templateSetting];
+ var setting = query[templateSetting];
if (_.isString(setting)) {
- options[templateSetting] = new RegExp(setting, 'g');
+ query[templateSetting] = new RegExp(setting, 'g');
}
});
- var template = _.template(source, options);
+ var template = _.template(source, _.extend({}, query, options));
return 'module.exports = ' + template;
};

0 comments on commit c0bd976

Please sign in to comment.