Ability to refer to a third party CSS and the associated images

NodeBB Development
  • A third-party vendor library, namely leaflet.js (and other files like leaflet.css and few images) is a part of my custom plugin.

    The leaflet.css references certain images lying in the ./images folder (relative to leaflet.css) During the NodeBB build, the contents of the leaflet.css are minfied and merged in stylesheet.css.

    But the ./images folder is not copied to the build directory. What do I need to do so that the leaflet.css should be able to reference the images folder. Do I need to make some entry in my plugin.json folder?

  • Creating a soft link to the images directory works.


Suggested Topics


  • 0 Votes
    4 Posts
    230 Views

    More specifically, the issue is that it defines a static directory in plugin.json:

    "staticDirs": { "s3": "public" },

    But doesn't have it.

    It seems to be an artifact of people forking and updating it without fully understanding what exactly it was doing - looking back at some history at some point someone moved the templates from public/templates to just templates/ and apparently NodeBB wasn't enforcing that directories have to exist at that point, so it wasn't noticed and all future forks inherited this bug.

    NodeBB is IMO doing fine here - a lack of directory a plugin declared to have might suggest some issue with the installation or the plugin itself (for example a typo in a path). A plugin incorrectly declaring something it doesn't use can't really be distinguished from these issues.

    Also, @julian while .gitignore works, I feel like it's a bit of abuse of that feature and the name is misleading (upon seeing a directory with .gitignore my first thought would be that something is supposed to go there but will be ignored. And I feel without knowing much about git I might've assumed it meant the whole directory would be ignored by git - the opposite of what it actually does). I personally prefer the convention of using an empty file named .gitkeep (or just .keep), since it more obviously refers to keeping the directory and wouldn't have any other potential impact on files included by git.

    EDIT: TL;DR of the issue:
    why would nodebb do this

  • 0 Votes
    3 Posts
    275 Views

    @miguel-guzman I just noticed that the Fiddle you included appears to have an API key embedded - hope that's not yours - otherwise, millions of random internet users will be getting this product for free whilst you pay for it 🙂

  • 0 Votes
    7 Posts
    2k Views

    Yes, I believe you either need to do this, or alter the jstree.js file itself to change references to jQuery to just use global (as in, don't require jQuery at all)

  • 0 Votes
    11 Posts
    3k Views

    @HolyPhoenix Thanks for catching that typo (I edited my comment, just now). I had correctly tried @psychobunny 's approach without luck but then typed it incorrectly.

    I found this post from @baris (https://community.nodebb.org/topic/5942/ajaxify-variables-get-deprecated) that says the .get('name') approach has been deprecated and that this style is current:

    ajaxify.data.tickettypes
  • 1 Votes
    7 Posts
    2k Views

    Sweet, thanks.