sassdoc icon indicating copy to clipboard operation
sassdoc copied to clipboard

Setting @name changes 'title' AND source.

Open himerus opened this issue 8 years ago • 6 comments

When using the following:

/// Breakpoint used for small screens with a screen width less than `$bp--mobile-landscape`
$bp--mobile:                          0px    !default; // Mobile Breakpoint.

I get the following output: screenshot of firefoxdeveloperedition 6-5-17 7-26-22 am

However, if I set the @name annotation to "Mobile Breakpoint", I'd expect the TITLE of the item in generated docs to change, but not the instance of the variable name in the source code:

/// Breakpoint used for small screens with a screen width less than `$bp--mobile-landscape`
/// @name Mobile Breakpoint
$bp--mobile:                          0px    !default; // Mobile Breakpoint.

Result: screenshot of firefoxdeveloperedition 6-5-17 7-27-04 am

Expected behavior: I'd expect that ONLY the 'friendly title' displayed above the item to be changed, and not any instances of the variable name inside the source code.

himerus avatar Jun 05 '17 11:06 himerus

For the sake of clarity, the rational behind the @name annotation was to work around dynamically generated placeholder selectors. We never really had a case where we would rename a variable because we consider that:

  • A variable name should be obvious or explicit enough that you don’t have to rename it.
  • Having a difference between the variable name and the item name in the docs could be confusing.

That being said, what your report still sort of looks like a bug. @pascalduez?

KittyGiraudel avatar Jun 08 '17 10:06 KittyGiraudel

Agree with you @HugoGiraudel.

But yes, we should probably prevent the annotation from renaming the variable.

pascalduez avatar Jun 08 '17 11:06 pascalduez

Thanks Guys!!

I definitely agree that in the case I demonstrated, variable names SHOULD always be named such that they are self-explanatory, in my case, I was just (while continuing to kick the tires a bit) attempting to give the actual headers for variables a more "reading friendly" title.

While users familiar with SCSS and standards set forth in things like bootstrap/foundation would look at $bp--mobile and say "Hey, $bp denotes a breakpoint, and this one must be for mobile!", I tend to try to write my documentation (when that ever happens!) for the most 'idiot proof' case, so this is why I was trying to get the header to essentially be "THIS IS THE Mobile Breakpoint Variable".

himerus avatar Jun 08 '17 19:06 himerus

Hey everyone, yeah @name annotation at first glance seemed to me smth for more user-friendly sass documentation and had the same issue as @himerus, would be possible to create another annotation specifically for the case when we want to rename variable name in sassdoc??

DedalusOsX avatar Nov 14 '17 06:11 DedalusOsX

Is there any update on this issue? Would love to also know what I could do, now — as a temporary measure, to prevent the @name overriding the variable. Thanks, guys.

williampansky avatar Dec 22 '17 05:12 williampansky

https://twitter.com/slicknet/status/782274190451671040

pascalduez avatar Dec 22 '17 08:12 pascalduez