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

Home Forums Support [Resolved] Can my GP Site-Library Child Theme use multiple CSS files? Best Practices?

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1410209
    michael

    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.

    #1410736
    David
    Staff
    Customer Support

    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.

    #1411546
    michael

    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

    #1411843
    Tom
    Lead Developer
    Lead Developer

    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 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.