1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

include 3rd party js file

Discussion in 'XenForo Development Discussions' started by Kintaro, Aug 3, 2014.

  1. Kintaro

    Kintaro Well-Known Member

    I'm releasing an addon that use a 3rd party js file.
    The js file will be included only on a specific template.

    In my testing env I'm loading it from js/myname/myaddon/3rdparty.js

    Is it ok like that or do you think it have to be loaded from js/3rdparty/3rdparty.js so other devs can rely on it without loading it twice or more?
  2. Chris D

    Chris D XenForo Developer Staff Member

    I'd say it would be safer to just load the stuff you need from your own add-on directory. Even if another add-on exists already that needs the same functionality, what happens when he other add-on wants to start using a new version? What if you do and it breaks another add-on using it that isn't compatible.

    Sometimes the joined up thinking is a nice thought, but can often lead to more problems than it solves.

    Also, I would urge you to consider first of all whether the XenForo framework already offers the said feature. It's not uncommon to see people using the jQuery Cookie plugin, but this is silly because XenForo is already capable of setting and getting cookies.

    That's just an example, but definitely worth checking out in case XenForo (or jQuery Tools) has something built in already.
    Kintaro likes this.
  3. Kintaro

    Kintaro Well-Known Member

    Thank you Chris.

    Is a little "derivated" of jQuery so I think is not included on xenForo's framework.
    I'm going to include it in my js add-on directory.

Share This Page