phgDigital / Project

1 stars 1 forks source link

Remove SASS Dependency #14

Closed phgDigital closed 7 years ago

phgDigital commented 7 years ago

In order to set primary and secondary colors SASS must be enabled in the Nebula Options. We should narrow down why this is necessary and find a work around so that SASS is not required for customization.

chrisblakley commented 7 years ago

One work-around I can think of would be to use inline styles for that if the Customizer was used to set the color and Sass is disabled.

The only thing I'm afraid of is if we need to do this a lot that would be too many inline styles.

The other thing we could do is an embedded style in the <head> with the same conditionals as above, and it sets a few selectors itself. We'd just have to remember that this exists so we don't get confused troubleshooting years from now.

chrisblakley commented 7 years ago

Here's what I came up with:

add_action('wp_head', array($this, 'subpage_head_no_sass_color'), 100);

public function subpage_head_no_sass_color(){
    if ( get_theme_mod('nebula_primary_color') && !nebula()->get_option('scss') ){
        ?>
            <style>
                /* Customizer styles if Sass is disabled */
                #bigheadingcon {background: <?php echo get_theme_mod('nebula_primary_color'); ?>;}
            </style>
        <?php
    }
}
chrisblakley commented 7 years ago

Closing this. Re-open if we think of other places that need Customizer colors without Sass.