0

I am customizing the Luma theme for a project and notice that the homepage blocks of Luma have very particular names for their CSS classes, for example home-erin, home-t-shirts etc.

I would like to rename the classes but always seem to miss some classes, which causes the frontpage images/blocks to break. So, all this manual labor to update classnames like home-pants to home-mid, home-eco to home-sale so our client knows what is what seems to be a hell of a job.

My actual questions: 1. Does anybody every tried the same thing as I do right now? If so, how? 2. Is there anybody who can think of a way of doing this quick, easy and with the best change of renaming all of the classes (so you don't forget anything) 3. Should I stop trying and just rewrite the whole thing?

Thanks in advance!

1 Answer 1

2

I would go for option 4: Don't change the provided templates by changing classes.

I know: Magentos' class names are not the most modern or logical one, they don't strictly follow any semantic approach (like BEM for example). But I've been working for quite a while now with Magento (since 1.6) and if there is one thing I can tell you is: "Do it 'The Magento Way'(tm)".

Don't try to swim upstream; I've made this mistake far too often myself. It's a hell of a job and as soon as the first patch or update comes out you have to do a lot of additional work. Also take into account that if you are going to use extensions you most likely have to re-template those as well, because they are most likely to follow the Magento conventions.

When it comes to templating / styling, add your own classes, re-use Magento styling, and try to do as much as possible by tweaking variables (you'd be surprised how much is possible with just that). Or you could always go headless ;-)

1
  • Thank you for your reply. It's good to see a reply from you, because I know that will result in an answer I can actually go with. Your answer is exactly what I was affraid of what would happen and but i had to ask, as the Dutch saying goes, while knowing better. I also forgot to mention those classnames are results from sample data, which makes it even harder to solve this in a solid way, after removing Sample data. Thank you for your fast response. Have a nice day!
    – Tristan N.
    Apr 19, 2018 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.