Home › Forums › Support › Can my GP Site-Library Child Theme use multiple CSS files? Best Practices?
- This topic has 3 replies, 3 voices, and was last updated 3 years, 8 months ago by Tom.
-
AuthorPosts
-
August 19, 2020 at 3:24 pm #1410209michael
My Configuration:
-I have the latest WP version 5.5, GP version 2.4.2 & GP-Premium version 1.11.3, Simple CSS version: 1.1.1
-I am using a child theme of SiteLibrary-Mellow.
-I am using Code Editor: Visual Studio CodeMy Process:
NOTE: I understand that I can have ONLY 1 style.css file & that it must only contain a Commented Header: (my file contains the following)
/*
Theme Name: cUcMe GenPress-Mellow-Child
Theme URI: https://generatepress.com
Description: Default GeneratePress child theme, from SiteLibrary-MellowTheme
Author: MEH
Author URI:
Template: generatepress
Version: 0.1
*/QUESTION: Is this above assumption correct, or does GP allow me to use multiple css files ??? My current SimpleCSS number of lines is almost 6000lines & growing !!!
It would be GREAT to have a CSS file per page of my site, for example.I have created a “simple-css.css” file in my Visual Studio Code working site directory. I first edit this file, then Copy & Paste replacing what is in GP-SimpleCSS.
This works fine, but is there a BETTER WAY… what are Best Practices ????
Thanks.
August 20, 2020 at 4:00 am #1410736DavidStaffCustomer SupportHi there,
WP allows you to add as many empty style sheets as you want. The most efficient method is using
wp_enqueue_style
function:https://developer.wordpress.org/reference/functions/wp_enqueue_style/
They can even be conditionally loaded if you so wish.
However, i would only really consider splitting styles if i had 1000’s of lines that were specific to a small number of pages that wasn’t required on the majority of the site.
Personally i would put it all in the child theme stylesheet. Now its in a file, the browser will cache it, so it only loads the once.
August 20, 2020 at 10:31 am #1411546michaelThanks David…
So I want to understand your advice clearly.
Are you saying that its OK for me to Deactivate the SimpleCSS plugin & copy all my CSS into my currently empty but commented Child style.css ???
I thought I read somewhere in your documentation, that when you have a “child” theme (as I do) created from your Site-Library theme, that the style.css must be empty & commented, & that you should use the SimpleCSS plugin???? Is this true???
Thanks
August 20, 2020 at 2:58 pm #1411843TomLead DeveloperLead DeveloperHi there,
Not at all, you can absolutely use a child theme
style.css
instead of using a plugin like Simple CSS.What you shouldn’t do is alter the parent theme stylesheet, so just make sure you’re using a child theme 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.