跨 CSS 文件重命名 HTML 类
如果我有 100 个 HTML 文件,这些文件使用一组在 CSS 文件中用作选择器的类,是否有一个实用程序可以用来智能地重命名这些类?
我知道每个编辑器/IDE 都有在项目中查找/替换的功能。使用 sed 你可以做同样的事情。这并不智能,因为它只是简单的字符串替换。我想知道有一个工具能够真正理解 CSS 类是什么以及如何替换它的实例。我想一个奇特的正则表达式可以做同样的事情。
If I have 100 HTML files that use a set of classes that are used as selectors in CSS files, is there a utility that I can use to intelligently rename the classes?
I know that every editor/IDE has a find/replace in project feature. Using sed you can do the same thing. This is not intelligent because it is a simple string replace. I want to know of a tool that actually understands what a CSS class is and how to replace instances of it. I suppose a fancy regular expression can do the same thing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为您正在寻找 Google 的闭包样式表。
其中之一闭包样式表功能是重命名。
闭包样式表重命名功能的示例如下。
也会
有进一步的缩小功能。
另请检查闭包编译器。
如果你检查任何 Google/Facebook 页面,你会发现它们的类和 ID 名称几乎不会超过 4 个随机字符
I think you are looking for Google's Closure stylesheets.
One of the closure stylesheets features is renaming.
example of closure stylesheets renaming features as following.
would become
There'll be further minification features too.
Also check closure Compiler.
if you inspect any Google/Facebook page, you'll see their class and ID names are almost never longer than 4 random characters
看一下 Netbeans 6.9 m1。它具有 CSS 重构/查找用法支持,也许这就是您正在寻找的。
http://wiki.netbeans.org/NewAndNoteworthy69m1#CSS_Refactoring_.2F_Find_Usages_Support
Take a look at Netbeans 6.9 m1. It has CSS Refactoring / Find Usages Support maybe that is what are you looking for.
http://wiki.netbeans.org/NewAndNoteworthy69m1#CSS_Refactoring_.2F_Find_Usages_Support
如果这仍然是最新的,那么有一个名为
rcs
的库,它是rename-css-selectors
的缩写。这是库,它非常容易使用: rcs-core
它附带很多插件,例如 webpack、parcel 和 node: https://github.com /JPeer264/node-rcs-core#plugins
If this is still up-to-date there is a library called
rcs
short forrename-css-selectors
.This is the library and it is pretty easy to use: rcs-core
It comes with a lot of plugins, such as webpack, parcel and node: https://github.com/JPeer264/node-rcs-core#plugins