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

Best practise for merging javascript with xenforo.js?

Marcus

Well-known member
#1
Is there a procedure for merging javascript from my addons with xenforo.js in eclipse and minimizing them? Or would I have to do that manually?
 

Jeremy

Well-known member
#5
Just because DigitalPoint does it, doesn't mean it's a best practice. It's actually far from a best practice and as Chris said, you should include it when necessary.
 

Marcus

Well-known member
#6
I want to remove the files needed to display my page. There are already two css files I have to submit. But Mike told me it's best to keep it that way, and I agree with him on the CSS output. So I want to reduce javascript files. Yes, it's true that for returning visitors everything will be cached anyway. But a huge part of my money comes in from users who visit my page, don't like it and click on a banner.

So I guess there isn't a best practise to combine scripts? Would be so great if there would be a tool inside ZEND / Eclipse.
 

digitalpoint

Well-known member
#7
I append our custom JS to xenforo.js with a web server rewrite btw... It's not *actually* merged (so don't need to do it on an upgrade or anything). For some things, there are separate JS files included as needed. The one I append is more universal stuff (like overwriting XenForo JS methods, Google Analytics, etc)
 
#8
My question is somewhat related, so I'll post to this thread.

I had to make some modifications to xenforo.js for our site (namely to the XenForo.BbCodeImage method to correctly zoom larger images on our centered layout with max-width set). It looks like the minified /js/xenforo/xenforo.js is merged from /js/jquery/jquery.xenforo.rollup.js and /js/xenforo/full/xenforo.js. Is this correct?

I cannot simply overwrite the BBCodeImage method since it's both defined and registered to img.bbCodeImage elements in xenforo.js.