Quantcast
Channel: XWiki Forum - Latest topics
Viewing all articles
Browse latest Browse all 1220

Proposal: LESS and CSS variable naming convention

$
0
0

Hi!

Context

When refactoring LESS variables at XWIKI-22893: Improve consistency of global LESS variable declaration in Flamingo by Sereza7 · Pull Request #3663 · xwiki/xwiki-platform · GitHub , i realized that we had pretty much already a LESS naming convention that was undocumented.

Proposal 1

Use kebab-case for LESS and CSS variables.

Explanation

  • Except for one LESS variable @loginFormMaxWidth, this convention is already respected in XWiki Standard. This was the LESS variable naming convention used in bootstrap.
  • This convention goes well with the CSS variable syntax: var(--login-form-max-width). It would be good to have a naming convention as soon as we start using CSS variables.
  • This is the same convention we use for naming HTML ids and classes. Adopting camel-case for variables in CSS/LESS too would keep some kind of consistency when writing stylesheets.

Proposal 2

Break backwards compatibility with @loginFormMaxWidth.

Explanation

  • This is the only LESS variable in XWiki Standard that does not follow the naming convention we were using off the books.
  • This variable has only been used in one specific place in XWiki Standard
  • It was never exposed in documentation.
  • Its name designates a very specific concept. I doubt it’d have been used in any customization. Could not find any usage in public extensions available on the XWiki org on github : Code search results · GitHub Even if it was used in a customization, its name is so specific that it shouldn’t break much (only some of the layout of the login form?).

All of the above makes me think that this variable should not be considered API and can be safely replaced by a new variable respecting the naming convention.

Conclusion

Here’s my personal +1 for proposal 1 and 2


Do you agree with those proposals?
If proposal 1 is validated, I’ll update our codestyle doc on https://dev.xwiki.org/xwiki/bin/view/Community/CodeStyle/XhtmlCssCodeStyle/#HCSS . If proposal 2 is validated, we’ll go through with the replacement on XWIKI-22893: Improve consistency of global LESS variable declaration in Flamingo by Sereza7 · Pull Request #3663 · xwiki/xwiki-platform · GitHub .

Thank you for your time!
Lucas C.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 1220

Trending Articles