Client side theme script not loaded

Technical Support
  • #1

    I could hardly restrain myself from biting into my desk out of frustration yesterday, trying to use Masonry on a custom page. My theme script file (nodebb-theme-themename/static/lib/themename.js) is correctly listed in plugin.json but not included in the minified nodebb.js.
    On the other hand (which is what troubled me), when I tried to include a script in the page itself that loads Masonry from a CDN and just initializes a masonry object, it kept being undefined.

    So maybe someone can tell me what is wrong here:

    $.getScript("", function(){ console.log('Script has been successfully loaded!'); });
    var masonryTest = new Masonry(); 

    that just gives

    // Uncaught ReferenceError: Masonry is not defined
    // (anonymous function) @ VM162:2
    // InjectedScript._evaluateOn @ VM117:883
    // InjectedScript._evaluateAndWrap @ VM117:816
    // InjectedScript.evaluate @ VM117:682

    Go ahead, try it yourself in the console at my site.
    I have the feeling I overlook the obvious...

  • GNU/Linux

    Just a thought... this look promising...

    require([''], function(Masonry) {
      var masonryTest = new Masonry();

    (Though I didn't pass a selector into the new Masonry(); call, so it errors out, but that should help.)

  • #3

    @julian Thanks, that works well! 😊 Though I still wonder why I cannot use my theme js... I took the skeleton for my theme for lavender and changed the name everywhere.. Have I forgot something?

  • GNU/Linux

    It's possible, have you pushed the repo to GitHub so we can take a look at it?

  • #5

    @julian, here it is. Thank you for your time!

Suggested Topics

| | | |