pykss
pykss copied to clipboard
Add support for naming sections
It'd be sweet to be able to do the following:
/**
* Styleguide 4.1 Buttons
*/
And when this gets parsed, "4.1" is still at Section.section
, while "Buttons" is at Section.name
This isn't in the KSS syntax documentation, but neither is the code examples feature.
This seems like a reasonable addition.
Looks like https://github.com/kneath/kss/pull/56 as merged, maybe it's just not documented yet.
This is implemented via #65, but hasn't been tested yet. Hopefully @bemurphy has time time to add some specs soon.
(I'll add it to the spec thereafter.)
I noticed your reference to kneath/kss#56, @seanbrant - I haven't merged anything into the main KSS repo. I merged that pull request into my own fork of KSS, for use in my own projects.
GitHub should make that a bit more understandable :(
Just to bump this one, it looks like they've merged kneath/kss#65
I'm a bit unsure how I feel about this feature, but I think I might warm up to it. My preference would have been Styleguide <index> <name>
. However I do see how maintaining numerical sections can be a pain in the ass. For example, if you add a pattern to your styleguide that's important, you may not want to simply increment the index, but rather place it "higher up".
On the other hand, trying to name everything appropriately could go to crazy town pretty fast.
Ultimately, I think what might work best would be having top-level sections as "word" keys, with associated children as numerical keys. For example, Buttons 1.0
. But now this seems like "Buttons, version 1.0"
I'm interested in hearing others' thoughts.
@benknight — Doesn't this change mean that you can do whatever you want? I think that sane patterns will fall out from building some larger stylesheets — I know my current project team were keen to use this feature (and drop the numerical notation)
Update: Yeah I'm pretty warmed up to this idea. I'd +1 maintaining parity with the Ruby implementation here. I'm not dying to have it though so I probably won't submit a pull request for anything here. Thanks for the spirited discussion dudes!