Global Helper variable docker



  • I am using jsreport with phantomjs and handlebar templating. I am running the project in Windows and on docker. While running it on docker, the zoom has to be adjusted because phantomjs has an issue. So I followed the steps here -> https://forum.jsreport.net/topic/188/dpi-option-doesn-t-seems-to-work/7
    The solution given by @bjrmatos to use zoom works. However, in his solution he says he created a variable to check the OS. I have a lot of templates and I dont want to put in every js file the same variable. I was hoping I could use global helpers.js, which is under asset and is shared helper attached to each template. But then when I declare a variable inside the global helpers.js file and try accessing it in the template, the variable is undefined. Can you please let me know what I could be missing.

    So my global helpers.js looks like this ->

    var os = require('os')
    // variable unix is coming as undefined in all templates
    const unix = os.platform == 'win32' ? false: true;
    
    function toJSON(data) {
      return JSON.stringify(data);
    }
    



Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.