kneath / kss

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

Allow string input for Kss::Parser #47

Closed goodtouch closed 11 years ago

goodtouch commented 11 years ago

Allowing string input (with Kss::Parser.load(string)) allows dynamic use cases in live web applications

Example:

buttons =<<-'EOS'
  /*
  Your standard form button.

  :hover    - Highlights when hovering.
  :disabled - Dims the button when disabled.

  Styleguide 1.1
  */
  button {
    padding: 5px 15px;
    line-height: normal;
    font-family: "Helvetica Neue", Helvetica;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    text-shadow: 0 1px rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    border: 1px solid #ddd;
    border-bottom-color: #bbb;
    background: #f5f5f5;
    filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='$start', endColorstr='$end');
    background: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e5e5e5));
    background: -moz-linear-gradient(top, #f5f5f5, #e5e5e5);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
  }
  button:disabled {
    opacity: 0.5;
  }
EOS
@styleguide = Kss::Parser.load(buttons)

We can then imagine a web app for prototyping designs or html components that would provide live kss documentation & demo rendering without relying on static files.

kneath commented 11 years ago

Love this idea, I'll take a look at the code and see if I can't cut a release here soon to include it.

goodtouch commented 11 years ago

Glad to ear you like the idea :smile:

I updated the pull request with the following :

I hope you'll like it !

goodtouch commented 11 years ago

Hi there !

Just wanted to know if you had time to review this one and if is ok for you ? :wink:

Thanks

kneath commented 11 years ago

Sorry about that, I haven't reviewed it yet. Failing a bit on being a maintainer. I'm gonna put it on my list to spend some quality time with KSS over the holidays.

goodtouch commented 11 years ago

Thanks for the feedback !

I'm building some cool stuff on top of this (that you might like ! But I'll come back to you later with this :christmas_tree: :gift: ), but there is no rush here either.

I'm now feeling guilty to bother with my pull request and would rather know you enjoy some quality free time during the holidays ! :wink:

kneath commented 11 years ago

Don't feel guilty! I don't mind email, and KSS needs some love. Planning on spending some time with it up in the mountains in between snowboarding for the holidays.

On Thu, Dec 20, 2012 at 9:11 AM, Jean-Paul Bonnetouche < notifications@github.com> wrote:

Thanks for the feedback !

I'm building some cool stuff on top of this (that you might like ! But I'll come back to you later with this [image: :christmas_tree:][image: :gift:] ), but there is no rush here either.

I'm now feeling guilty to bother with my pull request and would rather know you enjoy some quality free time during the holidays ! [image: :wink:]

— Reply to this email directly or view it on GitHubhttps://github.com/kneath/kss/pull/47#issuecomment-11581802.

Kyle Neath kneath@gmail.com http://warpspire.com

benschwarz commented 11 years ago

@neonelectro — So we can close this issue now?

arielkirkwood commented 11 years ago

@benschwarz - I'm confused, I certainly haven't solved this issue. I'm just using a workaround in my own project.

kneath commented 11 years ago

I'm still into this idea :+1: would love to see it get in. I think the references look a bit confusing here since it's a pull request in a fork (not from a fork).

goodtouch commented 11 years ago

Don't hesitate to give me some feedback if you want me to rework this in any way (like splitting the fix for the infinite js loop) :smile:

I've been using it for (quite) a long time now and it worked pretty well for my projects. It seems like @neonelectro used it successfully too ?

Anyone else tried it ?

( @kneath: I hope you had fun snowboarding btw :wink: )

benschwarz commented 11 years ago

@goodtouch It sounds to me like everyone is happy with this idea && the implementation looks pretty good. It'd be great if you could remove the js changes that you made (or rebase again from master perhaps).

Then we'll get a nice clean merge :-)

arielkirkwood commented 11 years ago

Yeah, I merged it into my own fork and it worked very well.

goodtouch commented 11 years ago

Here is the rebased version without the js fix

benschwarz commented 11 years ago

Merged. You rule!