在当前元素中,我被要求部署前压缩 HTML 类属性和相应的 CSS 选择器。 例如,生产代码是:
<div class="foo">
<div id="bar"></div>
</div>
.foo {/*Style goes here*/}
#bar {/*Style goes here*/}
在部署时,我希望替换 HTML 类和相应的 CSS 选择器:
<div class="a">
<div id="b"></div>
</div>
.a {/*Style goes here*/}
#b {/*Style goes here*/}
那里有什么可用的工具来存档此压缩文件?
最佳答案
如果你真的想重命名类名(记住 Madmartigan 所说的)Google Closure Stylesheets这样做。这是一种矫枉过正,YUI Compressor 或任何其他压缩 + gzip 压缩工具应该会给你足够的性能提升,但它可以做到。您必须使用其他 Closure 工具对您的 .js
文件和 html 模板进行适当的更改。
关于html - 在部署之前,是否有压缩 HTML class 属性和 CSS 选择器的工具?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8067546/