gulp - Minifying the conditional statement used in the comments of HTML using gulp
问题描述
I want to minify the following HTML code. I am using the gulp-cleanhtml which works fine for me except the following mentioned criteria:
it does not minify the Styles of HTML conditional statements. Check the below code:
<!--[if gte mso 9]>
<style>
sup
{
font-size:100% !important;
}
</style>
<![endif]-->
Can anyone guide me how to go about? So that I can minify the code within those conditional statements?
解决方案
gulp-htmlmin
应该通过以下选项将您带到那里:
.pipe(
htmlmin({
collapseWhitespace: true,
minifyCSS: true,
processConditionalComments: true,
})
)
这应该导致:
<!--[if gte mso 9]><style>sup{font-size:100%!important}</style><![endif]-->
推荐阅读
- python - 我们如何将用户重定向到 Django 中的指定管理员?
- android - 检查文件内容类型
- appium - 启动会话时 Appium 桌面服务器错误无法使用默认证书签名
- javascript - 对查询字符串应用 CSS - 我的代码不起作用,但为什么?
- java - 参数化 Cucumber 特征文件
- c# - 用于 syslog 的 Serilog ASP.NET Core appsettings 配置
- java - 用相同的开头但不同的结尾解析java中的字符串
- typo3 - Typo3 为所有子页面创建参考元素
- amazon-s3 - BucketNotEmpty - 409 冲突不起作用
- r - 对管道中的向量进行子集化和更改