英文:
Webpack HTML minifier is removing CMS {variables} from CSS rules
问题
我需要帮助使用html-minimizer-webpack-plugin
。现在,当我写这样的代码:
<style>
.video__embed {
aspect-ratio: {video_width}/{video_height} !important;
padding-top: 0 !important;
}
</style>
压缩器会移除{video_width}/{video_height}!important; padding-top: 0 !important;
,导致如下结果:
<style>.video__embed{aspect-ratio:{};}</style>
我如何配置这个插件以保持这些值不变,但仍然进行压缩?
英文:
I need help with html-minimizer-webpack-plugin. Right now, when I write this:
<style>
.video__embed {
aspect-ratio: {video_width}/{video_height} !important;
padding-top: 0 !important;
}
</style>
minifier removes {video_width}/{video_height}!important; padding-top: 0 !important;
, resulting in
<style>.video__embed{aspect-ratio:{};}</style>
How can I configure the plugin to keep those values intact, but still minified?
答案1
得分: 1
aspect-ratio: {video_width}/{video_height} !important;
这不是有效的CSS语法。我认为你应该在使用缩小器之前将其转译为有效的CSS。
英文:
aspect-ratio: {video_width}/{video_height} !important;
This is not a valid CSS syntax. I think you should transpile this to valid CSS before use minimizer.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论