2

Just a general question: I am just wondering, why every tutorial for child themes still includes the parent's stylesheet. Would it not be preferable to de-enqueue & to de-register the parent's stylesheet and then just to copy the parent's stylesheet rules right into the child theme's style.css?

This way, you would have one less page request on load and you'd also be able to change css rules directly without overwriting them by using child's css rules with a higher specification. If you are going to change the design in a fundamental way, you could save many kB's (and maybe repaints? I don't know).

Of course, I also see the downgrade aswell. If the author updates the theme with css changes, you will probably face abnormality in your design, because the updated parent's stylesheet will not be loaded. You then would have to target the css changes and apply them to your stylesheet.

But all in all I think, this could be worth it in regards to performance or am I totally wrong and am I overseeing some fundamental aspects?

2

This is not a very smart thing to do. As you noted yourself, you'll have issues when the parent theme is updated. Moreover, the parent theme might have secondary stylesheets that depend on the parent style (third parameter in wp_enqueue_style). There might be javascript that assumes it's there. In other words: it will take very thorough analysis of the parent theme to make sure you're not messing up something.

The upside is small. Yes, you'll have one file request less, but that's not a lot these days. Even a big css file usually is smaller in terms of kb than the images. And browsers won't choke on multiple css layers. Javascript is a bigger concern.

Simply said: it's not worth bothering about this.

  • thanks! Okay, it was just a quick idea, since the site should be build in best practice. But your arguments are easy to understand :) Thanks mate, have a great weekend! – DoUtDes Oct 28 '16 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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