kneath / kss

A methodology for documenting CSS and generating styleguides.
warpspire.com/kss
MIT License
4.04k stars 275 forks source link

Permit words for use as section keys. #65

Closed bemurphy closed 11 years ago

bemurphy commented 11 years ago

This is an experimental idea to allows words for section keys. So, Forms.Radiobuttons, etc. You could also mix/match like Forms.1 to isolate numbering changes.

It's possible it should require a flag to KSS parser to enable this mode.

It's also possible this is crazy. I kind of like the idea because then I think you can reorder (or not sweat the ordering when starting out) without having to edit toplevel numbers every time you shuffle.

twe4ked commented 11 years ago

I would love to see this merged. Any thoughts @kneath?

benknight commented 11 years ago

In my opinion a better thing to do would be to support this type of syntax:

Styleguide 10.1 Buttons

benschwarz commented 11 years ago

@twe4ked, @bemurphy This should absolutely be allowed — If you want to add some tests I'll handle the merge / acceptance.

bemurphy commented 11 years ago

@benschwarz got it, a bit slammed right now but should take of this soon. Thanks.

benschwarz commented 11 years ago

@bemurphy That'd be rad!

kneath commented 11 years ago

After thinking abotu this, I think this should be good. I'm not entirely sure why I kept it to numbers to begin with, but worst case we just go back to numbers once we find a problem with it.

bemurphy commented 11 years ago

@benschwarz added a few tests. My less and SASS are weak btw, just heads up.

BTW this probably needs a rebase before merge, I can take care of that.

I think I found an unrelated issue in the parer_tests while checking this btw, will open separate issue for tracking.

benschwarz commented 11 years ago

So the string can also be "Styleguide Buttons - Another descriptor", we don't need the dot, right? You sir, are a legend.

Can you add some details to the read me / spec docs while you're at it (otherwise people won't know the change that you've made here)

bemurphy commented 11 years ago

Sure, will add some doc shortly.

Not sure if the dot is needed, to be honest. Will write a test for it and see what happens. There should probably be at least one test fixture for that pattern in the .css file, checking for that if we keep it.

bemurphy commented 11 years ago

Oh shiny, I just tried:

// Styleguide Buttons - Core Stuff.

kss styleguide-1 and:

// Styleguide Buttons - Micro Stuff.

kss styleguide-2

in an install I've got and it seems to work there. neat.

benschwarz commented 11 years ago

So, so hot.

benknight commented 11 years ago

Decimal-style numerical keys still seems better than strings that are based on no naming conventions. Why not parse this string into two pieces of data?

For example: Styleguide 10.4 Buttons results in two fields on the section object, where "key" is "10.4" and "name" is "Buttons".

benschwarz commented 11 years ago

@bemurphy, I think this is ready to be merged. Any chance you can get it cleanly merging with master?

bemurphy commented 11 years ago

@benschwarz yeah I'll rebase and squash it later tonight I think

benschwarz commented 11 years ago

:heart:

bemurphy commented 11 years ago

Oops commented on wrong PR just now...

@benschwarz this is rebased and squashed.