-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSS class naming convention #1176
Comments
The naming scheme, as can be found in the “General Rules and Principles” section, is called BEM. It is actually very straight forward (although, admittedly, we did screw it up in a few cases). If the names are too long, I’d recommend using As for the |
I understand the (good) concept- In real life, it is harder than eg bootstrap- takes more time and more care also the -js thing, can it be like mdl-btn -js btn-fab btn-ripple btn-colored |
Well, I guess it is a good thing we aren't really competing with Bootstrap. The CSS selectors follow a specific set of rules and that can't be changed anytime soon. They are built to not collide as much as possible with other projects. So having If people have a hard time grasping it, sorry. BEM does take some getting used to, but once you are over that hump it is pretty nice for project developers. If someone wants to, they are free to make a package that is a scss sheet which generates shorter names. This is a specific design decision for this project and it isn't changing anytime soon. |
last try
this is only from a academic perspective a good solution |
Straight from the spec:
The naming comes right from the specification. Except we are aligning things right by default, so you specify that it is not numeric to get left alignment. |
I have a hard time following your argument. However: I do not believe that typing itself is actually what takes up most of time when developing. Especially when using any kind of editor that is aware of HTML and CSS, auto-completion will take care of that for you. Secondly, as @Garbee mentioned before, it keeps the markup very semantic and readable and is therefore suited for collaborative work.
We heard you that you think the class names are too long, but having dogfooded MDL myself (among other things by writing the templates) I personally disagree that the class names are an issue (that’s obviously a question of taste, though). If the class names alone are such a showstopper for you, you can either define your own shortcuts (which is a one-time task!) or, sadly, not use MDL. We made an informed decision to use BEM and this comes along with that. |
I just want to help to bring MDL Forward as I love the desgin and some ideas. For your better understanding I use VIsual Studio 2015 and IntelliSense. The feeling about the naming Comes from a presentation right in front of a 60 web dev audience. |
Is there a recording of this presentation available? Context may play a role here. If the classnames were just being spun off, but not detailed as to why they are this way then yes it can be very jarring. |
no recording- just the Project here on Github https://github.com/hannespreishuber/SKAP01 |
So, no context on whether or not the BEM style naming was explained. Nothing is changing here, but in the future making sure developers at least have a brief intro to BEM may prove helpful. Just seeing it getting used is awkward, but if you understand it, then things make perfect sense (unless we messed up, which has happened.) |
after doing a usergroup presentation for MDL I think that the naming shema of the classes should be changed.
-the names are to long
-the logic _- -- is not intutive
Bootstrap css typing is much faster
The text was updated successfully, but these errors were encountered: