Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support embedding example markup within KSS comments #37

Open
wireframe opened this issue Apr 11, 2012 · 7 comments
Open

Support embedding example markup within KSS comments #37

wireframe opened this issue Apr 11, 2012 · 7 comments

Comments

@wireframe
Copy link

Separating the HTML markup from the CSS has been a maintenance painpoint for my project and find that embedding it directly into the CSS documentation would be the most elegant solution.

example:

/*
 * Default button styling.
 *
 * :hover - highlight when hover
 *
 * Styleguide 1.1
 *   <button class="button $modifier_class">Example Button</button>
 *   <button class="button $modifier_class" disabled="disabled">Example Disabled Button</button>
 */
.button
  font-size: 16px
  margin: 0 auto
  &[disabled]
    background-color: #DDD

This is similar to YARD documentation's @example tag for self documenting ruby code.

@kneath
Copy link
Owner

kneath commented Apr 11, 2012

I'm actually really against this. Separation of markup and style!

But more specifically because CSS can apply to several different types of HTML structures at once. This would be a massive amount of noise in the CSS and not work toward a living styleguide (since your HTML is divorced from your application).

Here's a good example: https://github.com/styleguide/css/6 Section 6.1 has several different HTML structures, all of which are pretty heavy.

@glenngillen
Copy link

Gah. This would make my life much easier too, but can see how messy it would be for your counter-example.

Something about having to update documentation in two places just feels wrong though. This isn't about separation of concerns, that's still occurring within my app. This is about having all of the documentation in a single place so there's no need to context switch to see an example.

I don't have an elegant solution for when there are several different structures though :(

@kneath
Copy link
Owner

kneath commented Apr 20, 2012

Yeah, that's why I haven't really closed this issue yet. I'm not convinced what I have now is the best solution. But I'm pretty sure embedding markup isn't either.

@webholics
Copy link

  1. Look at the extended KSS syntax kss-node is using to generate the styleguide: https://github.com/hughsk/kss-node
  2. I think it should be good practice to keep modules small and to split growing modules into smaller parts. Therefore the markup section should never be too big.
  3. For me heaving markup in place with the CSS module helps in understanding complex CSS code.

@gagarine
Copy link

gagarine commented Apr 8, 2014

We are using https://github.com/jacobrask/styledocco and it use code fence (```) for the code. We build some large website and this was very nice to have the HTML code within the CSS as reference.

@gagarine
Copy link

gagarine commented Apr 9, 2014

I think we should support ``` and indentation and eventually "Markup:" like kss-node to make the two tools compatible.

@gagarine
Copy link

gagarine commented Apr 9, 2014

@kneath do you will accept a pull request for that? I want to add the support of optionally embed markup in the CSS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants