sassdoc icon indicating copy to clipboard operation
sassdoc copied to clipboard

Placeholder support

Open callum opened this issue 12 years ago • 7 comments

I would like to be able to document placeholders:

/**
 * Standard clearfix
 */

%clearfix {
  overflow: hidden;
}

Doesn't look like it would be too difficult to implement.

callum avatar Aug 03 '14 00:08 callum

Obviously, this seems useful. But we should think of any other additions then, and how it could impact the project. I guess we could also allow classes .whatever.

pascalduez avatar Aug 03 '14 06:08 pascalduez

To me, placeholders differ from classes in that they are reusable and repeatable; they're sort of like parameterless mixins. I'm not sure how you would rationalise adding classes as well, being that they're unspecific to Sass.

callum avatar Aug 03 '14 07:08 callum

The only difference between a placeholder and a class is the placeholder won't get printed if not extended. So they are as much as reusable.

Whether we should document only Sass specific items is a good point, and further opinions will be interesting on this topic.

I see some value to document CSS classes, but it's maybe more the job of a styleguide system ?

pascalduez avatar Aug 03 '14 07:08 pascalduez

I tend to think about placeholders like this:

%button {
  background-color: black;
}

.sign-up {
  @extend %button;
}

.sign-in {
  @extend %button;
}

Classes describe specific elements of your site, and placeholders define reusable behaviours that can be attached to them. .button as a class by itself is non-semantic. Placeholders don't need to be semantic; they're just a base on which to build other things.

I agree about the style guide thing. I suppose it depends on whether you care about what something looks like on top of what it does.

callum avatar Aug 03 '14 07:08 callum

This is the way I use placeholders as well, and really like it so far. Some sort of OO structure.

But it is not the only way, one might prefer the many classes in markup style. Whether this is a good technique or not is not something SassDoc should care about or enforce.

I'm all in favor of adding placeholders support in SassDoc. The underlying question it as raised is, where should SassDoc stop ? Are CSS classes already too much ? In its actual state, it is a great fit for libraries and APIs.

pascalduez avatar Aug 03 '14 09:08 pascalduez

Two different tools and comment style for documenting sass/css code is not the best option.

gisu avatar Aug 03 '14 10:08 gisu

Will be added in 1.4.

KittyGiraudel avatar Aug 20 '14 18:08 KittyGiraudel