Skip to content

Commit d6b65dd

Browse files
tommytroylinjantimon
authored andcommittedJun 3, 2018
feat: support ES6 template string in default loader
Only transpile EJS style `<%= name %>`, Close #950 BREAKING CHANGE: Template strings inside templates are now disabled by default
1 parent b94e043 commit d6b65dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎lib/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = function (source) {
2525
//
2626
// Get templating options
2727
const options = this.query !== '' ? loaderUtils.getOptions(this) : {};
28-
const template = _.template(source, _.defaults(options, { variable: 'data' }));
28+
const template = _.template(source, _.defaults(options, { interpolate: /<%=([\s\S]+?)%>/g, variable: 'data' }));
2929
// Require !!lodash - using !! will disable all loaders (e.g. babel)
3030
return 'var _ = require(' + loaderUtils.stringifyRequest(this, '!!' + require.resolve('lodash')) + ');' +
3131
'module.exports = function (templateParams) { with(templateParams) {' +

0 commit comments

Comments
 (0)
Please sign in to comment.