Thanks Thomas,
I had a look at the CSS bundle already, but I will definitely try and get a better grip on the rules you have there.
I think the idea of compressing as well as alphabetizing is good, but I wanted to make it fairly solid before I looked at integrating with anything else.
Alphabetizing is quite helpful when you get used to it, and certainly helps when you're inheriting a code base. The script seems to run very quickly, although I'm on a dual-core MBP.
Thanks for your reply,
Pete
On 11 Mar 2008, at 12:00, Thomas Aylott wrote:
From: Thomas Aylott - subtleGradient textmate@subtleGradient.com Date: 10 March 2008 12:37:17 GMT To: TextMate users textmate@lists.macromates.com Subject: Re: [TxMt] Bundle to alphabetize CSS rules Reply-To: TextMate users textmate@lists.macromates.com
Personally this comment would confuse me for my own CSS. But I can imagine it being useful for working with other peoples crazy CSS files.
There are already reformatting macros in the CSS bundle that I made to completely compress or pretty-print all your rules. It might make sense to merge these commands somehow. Depending on the speed of the php.
Check out the regex I use in those macros. I tried to make it pretty flexable and just ignore the contents of of the rules. I haven yet heard of anyone running into a rule that my redormatter breaks.
Thomas Aylott [SubtleGradient] from iPhone
On Mar 12, 2008, at 2:01 PM, pete otaqui wrote:
Alphabetizing is quite helpful when you get used to it, and certainly helps when you're inheriting a code base. The script seems to run very quickly, although I'm on a dual-core MBP.
Thanks for your reply,
Pete
Be aware that there are some other philosophies that make sense. While they all rely on bringing your rules in a certain order, they differ in the way of execution. For example, i usually practice something comparable but slightly different: All rules get grouped by function ("block layout", "positioning", "font&colors" etc.) and than alphabetized with an empty line between each group. I do have an sketchbook implementation for this somewhere on my book (in ruby), but it is far from usable ;).
Greetings Florian Gilcher
Yeah I agree, that would make it very difficult to decipher... I take the same approach in building CSS files that Florian mentions and it makes it very easy to go back and find classes and rules. Also that would have the potential to screw up any browser based hacks that rely on the order of the element definitions in the CSS. That could leave you pulling your hair out after you ran this script. -=Steven
On Wed, Mar 12, 2008 at 3:13 PM, Florian Gilcher flo@andersground.net wrote:
On Mar 12, 2008, at 2:01 PM, pete otaqui wrote:
Alphabetizing is quite helpful when you get used to it, and certainly helps when you're inheriting a code base. The script seems to run very quickly, although I'm on a dual-core MBP.
Thanks for your reply,
Pete
Be aware that there are some other philosophies that make sense. While they all rely on bringing your rules in a certain order, they differ in the way of execution. For example, i usually practice something comparable but slightly different: All rules get grouped by function ("block layout", "positioning", "font&colors" etc.) and than alphabetized with an empty line between each group. I do have an sketchbook implementation for this somewhere on my book (in ruby), but it is far from usable ;).
Greetings Florian Gilcher
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Mar 12, 2008, at 9:08 PM, Steven Ross wrote:
Yeah I agree, that would make it very difficult to decipher... I take the same approach in building CSS files that Florian mentions and it makes it very easy to go back and find classes and rules. Also that would have the potential to screw up any browser based hacks that rely on the order of the element definitions in the CSS. That could leave you pulling your hair out after you ran this script.
-=Steven
That is a valid point. But actually, that could be circumvented by making a command that only sorts the rule that the cursor is actually in. So you don't have to mind the whole document. Handling the whole document is also a bit more complex. (you have to consider comments that should remain where they where etc...)
I have a coding session planned this weekend, maybe i will get back to this. :)
Greetings Florian Gilcher
On Mar 12, 2008, at 4:15 PM, Florian Gilcher wrote:
On Mar 12, 2008, at 9:08 PM, Steven Ross wrote:
Yeah I agree, that would make it very difficult to decipher... I take the same approach in building CSS files that Florian mentions and it makes it very easy to go back and find classes and rules. Also that would have the potential to screw up any browser based hacks that rely on the order of the element definitions in the CSS. That could leave you pulling your hair out after you ran this script.
-=Steven
That is a valid point. But actually, that could be circumvented by making a command that only sorts the rule that the cursor is actually in. So you don't have to mind the whole document. Handling the whole document is also a bit more complex. (you have to consider comments that should remain where they where etc...)
I have a coding session planned this weekend, maybe i will get back to this. :)
Greetings Florian Gilcher
Come to think of it, I do the same thing... group my attributes based on "type" But only when there's a bunch of them. That would actually be a handy script. Sort rules by type and separate if there are bunches within a rule. —Thomas Aylott – subtleGradient—