Site logo

Archived topic

Can my GP Site-Library Child Theme use multiple CSS files? Best Practices?

3 replies · Started by michael on August 19, 2020

Viewing posts 1–4 of 4

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 Code

My 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.

Hi 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.

Thanks 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

Hi 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 :)

This archived topic is closed to new replies.