• 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)?

RickM

Well-known member
#1
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
 

Mike

XenForo developer
Staff member
#2
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.)