热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

缩小CSS类/id名称?-shrinkdownCSSclass/idnames?

tl;dr,whatseverybodysfavoriteCSSobfuscationtool?tl;博士,每个人最喜欢的CSS混淆工具是什么?Imtryingtof

tl;dr, what's everybody's favorite CSS obfuscation tool?

tl;博士,每个人最喜欢的CSS混淆工具是什么?


I'm trying to figure out ways to optimize our CSS delivery to improve our uncompressed initial download. We recently ran the compiled SASS through a minifier, which cut down the unnecessary whitespace, but I realized we've still got some bloat around the names we've given our classes.

我正在尝试找出优化CSS交付的方法,以改善我们未压缩的初始下载。我们最近通过一个minifier运行编译的SASS,它减少了不必要的空格,但我意识到我们仍然在我们给我们的类的名字周围有些膨胀。

I found a few questions on here asking about CSS obfuscation, but all of the answers have been focused around how that's a bad idea because obfuscation would make your CSS harder to read. I really didn't think those were satisfactory answers, partly because that argument applies equally to Javascript (which people minify all the time), but mostly because I've noticed some cool guys who make pretty popular web applications doing exactly this (ostensibly, to the chagrin of everybody here on StackO).

我在这里发现了一些关于CSS混淆问题的问题,但是所有的答案都集中在这是一个坏主意,因为混淆会让你的CSS难以阅读。我真的不认为那些是令人满意的答案,部分是因为这个论点同样适用于Javascript(人们一直在缩小),但主要是因为我注意到一些很酷的人做了非常受欢迎的Web应用程序正是这样做的(表面上看,感到StackO上所有人的懊恼。

I would've commented on these answers directly, but I haven't proven to the Overflowbots that I can talk, so I was forced to open a new question.

我会直接对这些答案进行评论,但我还没有向Overflowbots证明我可以说话,所以我被迫开了一个新问题。

Anyhow, I know there's a way to do what I want, and I know some really big applications are already following this practice. What are some good tools for minifying CSS class and id names for my site? Something that can plug into the Rails pipeline would be great, but not strictly necessary.

无论如何,我知道有一种方法可以做我想要的,我知道一些非常大的应用程序已经遵循这种做法。什么是一些很好的工具来缩小我的网站的CSS类和ID名称?可以插入Rails管道的东西会很棒,但并不是绝对必要的。

1 个解决方案

#1


0  

If you are familiar with the popular task-runner Gulp.js, you can use the gulp-selectors plugin to automatically minimize your css selector names.

如果您熟悉流行的任务运行器Gulp.js,您可以使用gulp-selectors插件自动最小化您的css选择器名称。

Read more about it here. https://www.npmjs.com/package/gulp-selectors

在这里阅读更多相关信息。 https://www.npmjs.com/package/gulp-selectors


推荐阅读
author-avatar
鬼蕾12_950_709
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有