Sorting CSS styles and classes in your files with a Python script
When editing CSS files, it’s quite common that the length of the file gets so big that it’s hard to find the classes in it. Some IDEs like Eclipse help you to show a sorted outline of the CSS file, but it will not sort the file for you as you want to. I’ve barely seen any larger projects with nicely structured CSS files, which is partially because neither the editors nor the tools are perfect for CSS editing. To highlight one of the many problems with CSS, let’s see a simple snippet: #mystyle li { color : green ; } input { background-color : red ; } #mystyle { /*should not use . and # with the same name!*/ } b { font-size : 1.2em ; } .mystyle { font-weight : bold ; } It’s a bit mixed up here and there, not well formatted, the DOM level CSS styles are mixed with the ID and class definitions, the names are not in sorted order. It’s pretty...