seven-phases-max/less-plugin-functions

Uppercase characters not supported in function names?

Closed this issue ยท 3 comments

Hello Max,

Thanks for the 2 less plugins you created (lists & this functions one) - I personally think both are much needed addition to less. ๐Ÿ‘
I played with this less-plugin-functions yesterday and couldn't get it to work when I used uppercase characters in my funtion names.

Example:

.function-getStyleNamespace { return: "namespace-"; }

@style-ns: getStyleNamespace(); 
@{style-ns}box { display: block; color: black; }

Output:


.function-getStyleNamespace {
  return: "namespace-";
}
getStyleNamespace()box {
  display: block;
  color: black;
}

If I lowercase the function name then everything works fine.

Regards,
R.

Less inherits case-insensitivity from CSS, so when you call a function it's name is always internally converted to lowercase... e.g. getstylenamespace. The plugin can't do anything about this (it uses also internal Less mixin search and there the matching is case-sensitive). Thus the camel style of naming is unfortunate and CSS-like naming (e.g. .function-get-style-space) is preferred.

Closing as expected behaviour (yes, sort of bug, but can only be fixed within the Less core).

Hi,
Ok - I understand.
Thanks for taking the time to reply & to explain.
Thanks again for both your lists & functions plugins.