Archived topic
How can i reduce the size of custom CSS?
7 replies · Started by Gaurav on December 3, 2020
Hi,
I want to reduce the size of custom CSS from the theme.
Like right now I have added some additional CSS codes from the theme customization option.
But i want to add these css codes to the theme editor by editing css files of the theme.
So that it doesn't affect my website speed.
Site URL: https://howtechhack.com/
Thanks.
Hi,
You can try either:
Manually copy the CSS in your Additional CSS in the customizer and then place it back in minified format.
Or,
Get a plugin that does that for you. Optimization plugins usually does the job as they minify, aggregate (combine all CSS into 1 file) and cache it.
Hi Elvin,
Thanks for the reply i am already using the optimization plugin and CDN also and minify CSS, js are checked.
But i don't want to use additional css instead i directly want to make changes to my theme.
Is it possible?
Thanks.
Hi there,
i am only seeing a few lines of CSS in your Additional CSS. Moving that inside a stylesheet would have no noticeable performance improvement. If you had 100's of lines then i would say otherwise.
Most cache plugins have an option to aggregate inline CSS which would move it into the combined CSS cached file.
Hi David,
Thanks, i got it but can you tell me for the future case if I get a 100's of line then where to put in the stylesheet and how?
Thanks
You would need to install a Child Theme and add your CSS to the child themes style sheet. More info on child themes here:
okay, thanks for the info.
You're welcome