• Hello!

    Does anyone know if it’s possible to somehow use the theme customizer settings with SCSS or maybe have a better solution to this problem:

    My problem is that I’ve got a scss file with all the color settings for my websites but I got this idea that I wanted to transfer this to the theme customizer and set all the colors in wordpress instead.

    Lets say I have a color setting in scss that looks something like this:
    @mainColor = #000000;

    and then a bunch of classes that get’s the color @mainColor in different ways. Links, backgrounds..whatever.

    Can I, in some way, through the theme customizer set @mainColor to whatever I want?

Viewing 3 replies - 1 through 3 (of 3 total)
  • This is possible using something like https://github.com/leafo/scssphp

    Check out this proof-of-concept code at Pastebin. Don’t use this code verbatim, as I don’t do any sanity checking or validating, but it’ll hopefully be enough to get you started.

    Thread Starter joelalexandersson

    (@joelalexandersson)

    Thanks Stephencottontail! That kind of of did what I wanted! Just one question. When i update the color from the wordpress customizer and it compiles into the css file. It just keeps adding classes like this and is never replaced:

    a {
    color: #2401a3; }
    a:hover {
    color: #130157; }
    a {
    color: #d33; }
    a:hover {
    color: #a81c1c; }
    a {
    color: #ee2; }
    a:hover {
    color: #b6b60e; }
    a {
    color: #d11b4b; }
    a:hover {
    color: #8d1233; }
    a {
    color: #19db15; }
    a:hover {
    color: #11950e; }
    a {
    color: #ff0707; }
    a:hover {
    color: #ba0000; }

    How can you achieve that it’s replaced instead of added over and over again?

    That’s why it’s proof-of-concept. 😉

    Try changing line 33 to this:

    $file = fopen( get_template_directory() . '/css/customizer.css', 'w' );

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Using WordPress Theme customizer with SCSS?’ is closed to new replies.