Materialize: Inconsistent naming of CSS classes

Created on 24 May 2017  路  7Comments  路  Source: Dogfalo/materialize

The repo uses kebabcase and camelcase inconsistently. As an example the userView class in _sideNav.scss.
Why is it not just kebabcase like most use?

https://github.com/Dogfalo/materialize/blob/master/sass/components/_sideNav.scss#L95

meta

Most helpful comment

@tomscholz Right.

I agree with both of you. How could we safely transition to one style in all files and slowly deprecate the old one?

For the beginning we would have to identify all places where this has to be changed, extend the rules (add the new class names and keep the old ones), probably somehow add some todo comments and make some roadmap when the old ones should be removed.

Suggestions for some good approach (and let other developers now about the transition and deprecation process)?

All 7 comments

I guess the others are variations like btn, btn-large, btn-floating (similar to BEM style?).

Not sure. Is this a critical issue (I doubt it)? Changing this would mean we introduce breaking changes and would have to change the docs and other places where this is used.

Yes it would be breaking so it is to late to change it, but it might be possible to slowly change it with a amount of updates.

Also it's more of a personal issue I have with it. It's kinda weird to have one style somewhere and another somewhere else. And even having them mixed. It is kinda confusing

@DanielRuf I agree with @DrowningElysium here. It's confusing to have multiple code styles

@tomscholz Right.

I agree with both of you. How could we safely transition to one style in all files and slowly deprecate the old one?

For the beginning we would have to identify all places where this has to be changed, extend the rules (add the new class names and keep the old ones), probably somehow add some todo comments and make some roadmap when the old ones should be removed.

Suggestions for some good approach (and let other developers now about the transition and deprecation process)?

@DanielRuf We'd have to decide on a consistent naming style (i like _foo-bar_ the best), and then look through all the names and when we see a name that doesn't match we create a duplicate with the correct naming conventions. Then for each one that we did this for we look through the docs and update that there's a new syntax and that the old one is deprecated. Another thing that can really help would be making a JS function on load that detects if there's an element with a deprecated class name in the html and if so it should log it to the console with a warning that the syntax is deprecated.

@tomscholz shouldn't we keep this open and check all other lines and remaining files too or do you have this in one board of the projects so we can take another look at it again in the future?

userView has been removed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

acierpinski picture acierpinski  路  3Comments

hartwork picture hartwork  路  3Comments

djensen47 picture djensen47  路  3Comments

ReiiYuki picture ReiiYuki  路  3Comments

ruslandzhumaev picture ruslandzhumaev  路  3Comments