Skip to content
  • NodeBB templating on other projects

    General Discussion
    2
    0 Votes
    2 Posts
    286 Views
    barisB
    Yes if you have your own expressjs app then you should be able to use the templating engine we use. It is a separate project here https://github.com/benchpressjs/benchpressjs.
  • 0 Votes
    7 Posts
    1k Views
    magnusvhendinM
    @baris This worked like a charm. Thank you!
  • 0 Votes
    5 Posts
    1k Views
    NoduleJSN
    problem solved. i have to import external script with require([script], function(name) { }) It seems that importing scripts in a classic way creates conflicts in nodebb
  • Benchpress is undefined clien side

    Moved NodeBB Development
    5
    0 Votes
    5 Posts
    1k Views
    magnusvhendinM
    Thank you @PitaJ for pointing me in the right direction. I adapted my code to the link you sent me. (function (factory) { if (typeof module === 'object' && module.exports) { factory(require.main.require('benchpressjs')); } else { require(['benchpress'], factory); } }(function (Benchpress) { const logger = (data) => { console.log('Logger helper', data); return ''; }; const customHelpers = { register, logger, }; function register() { Object.keys(customHelpers).forEach(function (helperName) { Benchpress.registerHelper(helperName, customHelpers[helperName]); }); } register(); if (typeof module === 'object' && module.exports) { module.exports = customHelpers; } })); Just by doing this made it work client side. But then it stopped working server side. That was easily fixed though by running helpers.register in my library file. const helpers = require('./lib/helpers'); helpers.register(); Hope this helpes someone!
  • 0 Votes
    5 Posts
    709 Views
    A
    Thanks ! I had tried this before but something else was wrong. Now, everything is ok !!! Thanks again !