Answer the question
In order to leave comments, you need to log in
How to ignore xtemplate syntax in html-minifier?
I am using xTemplate. The goal is to minimize code when building.
I use grunt + html-minifier.
my settings are like this:
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true,
minifyJS: true,
minifyCSS: true,
useShortDoctype: true,
removeCommentsFromCDATA: true,
ignoreCustomComments: [
/^\s+<!-- BEGIN/,
/\/ -->\s+$/,
/^\s+{/,
/^\s+}/
]
},
expand: true,
cwd: '.template/',
src: ['*.xtpl'],
dest: '.template/test/'
}
},
Warning: .template/page-assets-menu.xtpl
Parse Error: <option<!-- BEGIN: this --> selected="selected"<!-- END: this -->>{ROW.name}</option>
<!-- END: countries -->
</select>
</div>
</div>
<option selected="selected">Все страны</option>
<!-- BEGIN: countries -->
<option<!-- BEGIN: this --> selected="selected"<!-- END: this -->>{ROW.name}</option>
<!-- END: countries -->
Answer the question
In order to leave comments, you need to log in
try like this:
ignoreCustomComments: [
/^\s+<!-- BEGIN/,
/ -->\s+$/,
/^\s+{/,
/^\s+}/
]
ignoreCustomComments: [
/<!-- BEGIN/,
/-->/,
/^\s+{/,
/^\s+}/
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question