The best approach to scramble CSS definitions to a human-unreadable state throughout an ASP.NET application

爷,独闯天下 提交于 2019-12-11 08:37:20

问题


I'm not sure if it will bring anything beyond saving on traffic through the removal of long-worded names, but I would definitely want to hide my system of namings, declarations and their organization.

The thing is that manual Find&Replace is going to take a very long time, and each slight modification could probably require the process to be redone in part or in whole.

Has anyone thought of this problem? Maybe write a macros? Will it be intelligent enough to be able to discover names in a CSS file? Does anything better and simplier exist?


回答1:


You can't make it "unreadable", but you can save some space by using things like the CSS optimizer




回答2:


You might want to try YUI Compressor:

http://developer.yahoo.com/yui/compressor/




回答3:


Firstly I don't think I would do it at all, what exatly is to be gained by making it less readable?

But if one had to do it, why not make a custom parser that would convert your "development" names to "production" names and vice versa as needed?




回答4:


Use Perl. A simple perl script can search through all of your files recursively and replace whatever you specify with something else.




回答5:


Use a CSS compressor. It will make it really hard to read, but it's not possible to make it completely unreadable. Here's one from CSS Drive.




回答6:


As others have stated, you can make the names shorter or less meaningful, but to reach a human-unreadable state is essentially not possible.

No matter how you rename or distort the css, it still has to have proper atributes and the html has to reference the named classes and/or ids. Additionally tools like firebug will unfailingly point users to the css being used which I assume will defeat your intent.

It also defeats the purpose of using semantically meaningful tags in your html.



来源:https://stackoverflow.com/questions/558877/the-best-approach-to-scramble-css-definitions-to-a-human-unreadable-state-throug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!