Home › Forums › Support › GP Customizer, GP Elements or Simple CSS: Best option for better performance?
- This topic has 5 replies, 3 voices, and was last updated 6 months, 4 weeks ago by
Leo.
-
AuthorPosts
-
August 27, 2022 at 1:46 am #2325301
Sascha
Hello,
sometimes I only need CSS for specific pages and in the past I have always used “Simple CSS” plugin for that.
Not I have realized, that using “Simple CSS” sometimes creates additional load assets.
After moving the CSS to the Customizer (“Generating your dynamic CSS in an external file” is enabled), I noticed a faster load and better PageSpeed Scores.
But most of the custom CSS is not required to load on all pages, I wonder if loading CSS via Hook-Element would have the same effect as using Simple CSS? Or should I even use a child-theme as the best option?
For the best performance & scores, I’d like to learn about the best practice for applying custom CSS to single or multiple, but not all pages:
Simple CSS?
Customizer CSS?
Element-Hook?
Child Theme?Can you please guide me to the right direction?
Thank you in advance and kind regards,
SaschaAugust 27, 2022 at 5:18 am #2325407David
StaffCustomer SupportHi there,
the big question here is how much CSS do you have that is only required for those specific pages?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 30, 2022 at 6:40 am #2328277Sascha
Hi David, thank you for your reply.
You mean, the decision for using any of the options depends on the amount of CSS-code?
I would assume it’s never more than 10-50 lines of code.
Thanks
SaschaAugust 30, 2022 at 6:50 am #2328287David
StaffCustomer SupportThats correct.
If you’re worried about loading an additional 10 – 50 lines on pages that don’t require it, then don’t be. It really won’t make a difference.I would only be concerned if there were 100’s of lines of CSS. And then i would opt for a Child Theme stylesheet so the browser can cache it.
If there is 100’s of lines of CSS for just a single page or a few pages, then i would use a child theme with a separate stylesheet that was enqueued just on those pages. Which would require a little PHP.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 30, 2022 at 11:01 am #2328660Sascha
Thanks.
So, I still wonder about the best options for this small amount of 10-50 lines of CSS:
Simple CSS?
Customizer CSS?
Element-Hook?Child Theme seems overkill …
Thank you in advance and kind regards,
SaschaAugust 30, 2022 at 11:05 am #2328662Leo
StaffCustomer SupportI would say the Additional CSS field in the customizer (WP core feature) would suffice for 10-50 lines of CSS.
If you want to dig deeper, simply add the CSS using each method then run the site through some speed tests for comparison 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.