Closed lz000 closed 9 years ago
Facing the same problem here.
Looks like it is related to options.templateSettings: https://github.com/dciccale/grunt-processhtml/compare/0.3.2...0.3.3
Maybe @fdeberle what are your grunt options for the plugin @lz000 ?
I guess nothing special about it:
processhtml: {
prod: {
options: {
process: true
},
files: [
{
expand: true,
cwd: 'distProd/',
src: ['*.html'],
dest: 'distProd/',
ext: '.html'
}
]
}
}
looking into this issue, i was able to replicate it will do some tests to see why that happens.
if you remove the option process: true
it will work. If that option is true, the whole already processed html will go through lodash template to replace variables in the file. it seems that lodash is trying to replace ${lang}
with some value, the weird thing is that lodash/underscore template default settings uses <% %>
kind of syntax.
you need to escape that expression
newer version of lodash uses ES6 interpolation check this issue https://github.com/lodash/lodash/issues/1009
so if you want to use process: true
you need to change the templateSettings
option to something else like the old ones:
processhtml: {
prod: {
options: {
process: true,
templateSettings: {
interpolate: /<%=([\s\S]+?)%>/g
}
},
files: [
{
expand: true,
cwd: '.',
src: ['*.html'],
dest: 'distProd/',
ext: '.html'
}
]
}
}
I have "${lang}" in my html and this caused a warning: "lang is not defined Use --force to continue". The issue does not exist in 0.3.2. Any idea?