Hello there,
(I am using Sage 9)
I would like some advice on the best possible way to approach my problem if anybody has some.
The setup:
- I have my Wordpress Customizer setup with custom settings and controls. (brand colors etc)
- I have my SCSS stylesheets, with my variables setup in the respective SCSS file as of now.
The concept :
I need the SCSS style to be compiled with my WP Customizer variables every time they are changed in the back-end of WP.
I know that I can hard code some style tags inside of the pages (inline style) and grab the variables with some php but what I need is to have a separation of concerns, meaning I do not want to put any style inside the pages themselves.
Here’s what I tried as of now :
Attempt 1 :
I simply followed the WP Customizer tutorial, but they inject the style via JS directly into the markup, which as I said do not want to do.
Attempt 2 :
I installed the WP-SCSS plugin from the WP backend. This plugin can read the variables from the WP Customizer and add them to the SCSS before compiling it to CSS.
However I ran into a problem because the plugin asks for a path for the source files and a path for the destination css and I cannot get these to work…
Configure Paths
Add the paths to your directories below. Paths should start with the root of your theme. example: "/library/scss/"
Scss Locat ion :
/ressources/assets/styles/
CSS Location :
/dist/styles/
It might very well be a problem to do with the way the assets are served but I have little knowledge in routing, I tried to look around the source and the docs and the only thing I could find is how to enqueue new assets which might come in handy later but as of now I need to understand why I can’t get the plugin to work.
I have no idea how to achieve what I want to do, I’ve been searching around for hours and it seems that this way never answered before but I might be wrong, could be using the wrong search terms…
Anyways this is what I came up with, and there might be an easier and less dependable way of doing this so any input would be greatly appreciated.