【发布时间】:2020-03-24 20:01:24
【问题描述】:
这是我的 HTML 页面的简短版本,其中包含 <xmp> 代码 sn-ps 标记:
<div class="container">
<a href="#">Aqua Dotted Link - Default</a>
<br /><br />
<a href="#" class="a-gold">Gold Dotted Link</a>
<h3>Code for Footer: </h3>
<pre><code><xmp><u>This is U tag with underlined aqua - Default </u>
<u class="u-gold">This is U tag with underlined gold</u>
<u class="u-orange">This is U tag with underlined orange</u></xmp></code></pre>
<p>Hello World</p>
<p>Hello World 2</p>
</div>
使用gulp-htmlmin,我在gulpfile.js 中执行以下操作:
let htmlmin = require('gulp-htmlmin');
...
gulp.task('html', gulp.series('clean', function() {
return gulp.src(globs.html)
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true,
}))
.pipe(gulp.dest('./dist'));
}));
...
我不知道出了什么问题,但这是我得到的输出:
<div class=container><a href=#>Aqua Dotted Link - Default</a><br><br><a href=# class=a-gold>Gold Dotted Link</a><h3>Code for Footer:</h3><pre><code><xmp><u>This is U tag with underlined aqua - Default </u>
<u class=u-gold>This is U tag with underlined gold</u>
<u class=u-orange>This is U tag with underlined orange</u></xmp></code></pre><p>Hello World<p>Hello World 2</div>
我怎样才能让 gulp 识别<xmp> 标签以便它可以缩小它?
【问题讨论】:
标签: javascript gulp minify