diff --git a/index.js b/index.js index ed9c937..a171ec1 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,17 @@ var _ = require('lodash'); var loaderUtils = require('loader-utils'); +function getOptions(context) { + if (context.options && context.options.ejsLoader) { + return context.options.ejsLoader; + } + return {}; +} + module.exports = function(source) { this.cacheable && this.cacheable(); var query = loaderUtils.parseQuery(this.query); - var options = this.options.ejsLoader || {}; + var options = getOptions(this); ['escape', 'interpolate', 'evaluate'].forEach(function(templateSetting) { var setting = query[templateSetting];