CSS 最小化器?
您是否知道在线 CSS 压缩器可以帮助删除冗余/低效的 CSS 声明并用更优化的 CSS 替换它?
意思是,我知道存在很多“压缩器”,它们只是删除选项卡、删除注释等。
但我正在寻找的是足够聪明的东西,知道:
border-top: 1px solid red;
border-bottom: 1px solid red;
border-right: 1px solid red;
border-left: 1px solid red;
与更高效的相同:
border: 1px solid red;
更新< /强>: 我试图优化的 CSS 位于下面的链接
Do you know of an online CSS compressor that helps remove redudant/ineffecient CSS declarations and replaces it with more optimized CSS?
Meaning, I know that a lot of "compressors" exist that simply remove tabs, remove comments, etc.
But what I'm looking for is something smart enough to know that:
border-top: 1px solid red;
border-bottom: 1px solid red;
border-right: 1px solid red;
border-left: 1px solid red;
is the same as the more efficient:
border: 1px solid red;
UPDATE:
The CSS I'm trying to optimize is at the link below
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个可以吗?它尽可能美化、缩小、合并和简化规则,并且具有高度可配置性。
Will this do? It beautifies, minifies, merges, and simplifies rules where possible, and is highly configurable.
Clean CSS 是我之前尝试过的一种。
但是,对于合并规则的示例,我强烈建议您手动执行此操作,因为在某些情况下,任何自动工具都可能会弄乱某些内容或无法实现优化。
例如,如果您有:
优化此问题的最佳方法是:
但优化器可能无法捕获此问题。
编辑
尝试了上面的例子,Clean CSS 并没有达到要求。然而,FlumpCakes Optimizer 更好。它抓住了你的例子,但没有抓住我的高级例子。
Clean CSS is one I tried before.
However, for your example of merging rules I highly recommend doing it by hand, because there are situations where any automatic tool could mess something up or not catch an optimization.
If you had, for example:
The best way to optimize this is:
But an optimizer may not catch this.
EDIT
Tried the above example and Clean CSS didn't cut the mustard. However, FlumpCakes Optimizer is better. It catches your example, but not my advanced example.
尝试 Devilo.us
它还可以让您控制代码的压缩程度。
Try Devilo.us
It also gives you control over how much you want to compress your code.