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

Use the template system for Javascript (like we do for CSS)?

Discussion in 'XenForo Development Discussions' started by RickM, Nov 9, 2010.

  1. RickM

    RickM Well-Known Member

    Hi - me again!

    I was just curious, is it possible to use the template system for custom javascript files, like we do with CSS?

    (e.g can we do something like <xen:require js="somefile.js" /> where 'somefile.js' is a template?)

    Not an issue if we cant - just curious to know if it was possible.

    Cheers
     
  2. Mike

    Mike XenForo Developer Staff Member

    No, JS requires include JS files from the system. If you want to include a JS template, you'd have to just include it. Ideally though, you shouldn't be embedding JS inline. It's generally preferable to have it loaded via a separate file and called via CSS-style selectors. (Obviously, there are certain situations where JS is or should be embedded, but in our case, they're infrequent.)
     

Share This Page