Skip to content

Instantly share code, notes, and snippets.

@KittyGiraudel
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save KittyGiraudel/4e19a57a5173636fda48 to your computer and use it in GitHub Desktop.

Select an option

Save KittyGiraudel/4e19a57a5173636fda48 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
// One thing I do like in programming languages
// is the ability to "type" variables,
// especially in functions signatures.
//
// Unfortunately, Sass does not allow this. So
// I was thinking we could add the type right
// before the argument in the signature.
//
// This seems like a decent way of showing what
// is expected by the function/mixin.
//
// What do you think?
// ---
// Mixin
// ---
// @param [color] $theme: color from theme
// @param [map] $options: options
// ---
@mixin whatever(/* color */ $theme, /* map */ $options) {
// ...
}
@elussich
Copy link
Copy Markdown

I like it. And we might as well use JSDoc to document it with additional details, more in this fashion:

/**
 * Mixin description here.
 *
 * @mixin whatever
 *
 * @param  {Color} $theme   Some color...
 * @param  {Map}   $options A map of options...
 * @param  {Unit}  [$size]  An optional size value...
 *
 * @return {Class} Here we could even describe what will be the outcome of our mixin...
 */
@mixin whatever(/** color */ $theme, /** map */ $options, /** unit= */ $size:16px) {
  // ...
}

@KittyGiraudel
Copy link
Copy Markdown
Author

@elussich Is JSDoc working on Sass files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment