Darep / middleman-kss

KSS (Knyle Style Sheets) helpers for Middleman
MIT License
19 stars 4 forks source link

Styleblocks should be interpreted as templates #1

Closed lolmaus closed 10 years ago

lolmaus commented 10 years ago

It is common to have a Middleman partial for every module that is to be documented with KSS. The middleman-kss gem does not allow including partials into styleblocks.

E. g. source/styleblocks/_main_menu.html.erb:

<%= partial 'partials/main_menu', locals: { foo: 1, bar: 2} %>

Resulting style guide's HTML:

<p>&lt;%= partial 'partials/main_menu', locals: { foo: 1, bar: 2} %&gt;</p>

It seems like styleblocks aren't processed at all. This problem leads to severe duplication of code and results in extra dreary work.

Also, it should be possible to write styleblocks with any of the template engines that Middleman supports.

TL/DR

  1. implement parsing styleblocks as Middleman templates;
  2. allow using Haml and other template engines for styleblocks.
lolmaus commented 10 years ago

Okay, i understood why styleblocks are not interpreted: their code should appear as plain text, not as HTML interpreted by the browser.

But this fact does not remove the necessity to reuse existing partials to generate styleblocks. Can you think of something?

Darep commented 10 years ago

Hi, and thanks!

Yeah, this looks like a must-have feature: rendering partials with different engines and such in the styleblocks. I would probably like to have this in my styleguides some day, too.

I'm currently busy at work preparing for a startup event here in Finland. So, this and the next week are pretty busy... But I will do my best to find some time for this :) Are you in a hurry? Hehe

lolmaus commented 10 years ago

I'm still struggling to make middleman-kss work.

When i do <%= styleblock 'main_menu' %>, it works fine.

But when i do <%= styleblock 'main_menu', section: '1.1' %>, it produces this error: http://jsbin.com/eLAZilO/1/?html,output

middleman-styleguide-template's project structure does not suit me at all, so i tried to make middleman-kss work on my project structure by following its readme.

Here's my project: https://github.com/lolmaus/middleman-kss-sandbox Can you please tell me what's wrong there?

Darep commented 10 years ago

Ok, let's see...

Ah, yes. middleman-kss is not compatible with Middleman 3.2.0, sorry. I downgraded your project to 3.0.12 and it worked :) When I get the time, I will make middleman-kss run with Middleman 3.2.0. But not right now, sorry.

lolmaus commented 10 years ago

Oh my god, it works!

Thank you for support, Darep.

I'm sorry for hijacking this issue. Let's leave it open for it's main topic: implementing proper parsing of styleblocks.

I'll update the initial post and also create tickets for other issues.

PS Good luck at your event!

Darep commented 10 years ago

No problem :) And hey, thanks to you, too! I now got fresh motivation to push this project forward

Darep commented 10 years ago

Seems to be working now! For me atleast :)

:hammer: