Sign in

Can’t seem to get visual-override.js to work

  • This topic has 1 reply, 2 voices, and was last updated 2 weeks, 2 days ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4139
    Retisi

    Howdy,

    I’m messing around making a theme from scratch/general learning and I can’t get the visual-override.js file to work – even when I dumbed down the code to what’s below.  Chrome developer tools show nothing so I’m assuming I’m doing something wrong with the override file.  I created the file and placed it in the root directory of my theme (which is entirely barebones at the moment).

    // visual-override.js
    
    
    // Just trying to see if I can get this little color override to work
    var generateOverride = function(params) {
        return "a { color: #0FFFF0; }";
    };
    
    module.exports = generateOverride;
    /* main.css */
    
    
    /* These were set in the config file and when the colors didn't override I decided to test with the above JavaScript and a link.
       Just including this to show that the css file is pretty much empty */
    :root {
        --body-bg-color: #000000;
        --text-color:  #FFFFFF;
    }
    
    body {
        background: var(--body-bg-color);
        color: var(--text-color);
    }
    

     

    {{! index.hbs }}
    
    {{! Just has opening tags }}
    {{> head}}
    
    Link
    
    {{! Just has closing tags }}
    {{> footer}}

     

     

    I have a feeling it’s an obvious fix, but I’m not seeing it – especially since I don’t really know how to use JavaScript off the top of my head.  Thanks for your help!

    #4143
    Bob
    Support

    Check out the Simple theme, you will see how the visual-override.js works.

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

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