adding and using library
-
@Nisthar yes can use cdn. right now trying to learn and understand how to add any library.
another example:
foundation site shows this in head
<link rel="stylesheet" href="css/foundation.css" />
and this before the closing body
<script src="js/foundation.min.js"></script>
that part I understand for standard html file by creating the css and js folder and including the files but I want to do that inside nodebb.
Where do I put the css and js file for any library so it can be referenced and use for nodebb?
Not sure if I'm giving right details. Hope that make sense
-
Hey @charles, unfortunately, there's not one solution that will work for every library.
Many libraries will work just by adding the
<script>
tag alone to yourCustom Header
section of the ACP. But some are picky about in what order they get loaded, some won't work at all (without some help), and some will need you to use a require() call to load them. If we knew the specific library/s, I think we could be of more help.As far as uploading the library, everything in the
/public
directory is exposed on the website root. So, you can generally put the library anywhere in there. -
Just saw you posted about foundation.
foundation should work by adding the <script> tag, but you'll also need to reload it whenever the page changes, like so:
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.2.0/foundation.min.js"></script> <script> $(window).on('action:ajaxify.end', function(){ $(document).foundation(); }); </script>
-
@yariplus said:
As far as uploading the library, everything in the
/public
directory is exposed on the website root. So, you can generally put the library anywhere in there.This is what I was looking for! Thanks!
As for loading a js file at the end right before the closing body, which file should I place the script tag?