Skip to content

Commit

Permalink
feat: support ES6 template string in default loader
Browse files Browse the repository at this point in the history
Only transpile EJS style `<%= name %>`, Close #950

BREAKING CHANGE: Template strings inside templates are now disabled by default
  • Loading branch information
tommytroylin authored and jantimon committed May 18, 2018
1 parent 7712df7 commit b6df42c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/loader.js
Expand Up @@ -25,7 +25,7 @@ module.exports = function (source) {
//
// Get templating options
const options = this.query !== '' ? loaderUtils.getOptions(this) : {};
const template = _.template(source, _.defaults(options, { variable: 'data' }));
const template = _.template(source, _.defaults(options, { interpolate: /<%=([\s\S]+?)%>/g, variable: 'data' }));
// Require !!lodash - using !! will disable all loaders (e.g. babel)
return 'var _ = require(' + loaderUtils.stringifyRequest(this, '!!' + require.resolve('lodash')) + ');' +
'module.exports = function (templateParams) { with(templateParams) {' +
Expand Down

0 comments on commit b6df42c

Please sign in to comment.