combining and minifying JS

Started by drewactual, April 24, 2019, 08:39:03 AM

Previous topic - Next topic

drewactual

css is easy... JS is a PITA.   I guess it's all about getting them in the right order and eliminating conflicts.  I'm knee deep in this and have been caught on a significant snag I seek help for:

question 1: jQuery~ On my page there are calls to jQuery from 1.7 to 3.3.1, and all by mod's.  the base page will operate in any browser i've tested w/o any calls to jQuery at all- a testament to modern browsers?- but several mod's need them, apparently.  However, I've discovered through trial and error that 3.3.1 will operate ALL the mod's as expected and there is no need for additional calls.... so.... is this wise?  My objective is to call in either a combined and minified JS with the jQuery atop all others, or, jQuery only the one time (directly from the content delivery service; e.g. google) and then a combined JS.   what is the best way to go about this in your experience (which has just about got to be more than mine)?


  • question 1(b) :  If it is possible to centralize a single call to jQuery either minified or stand alone to the delivery service, is making it work as intended as simple as combing through the mod files and removing calls to jQuery?

question 2: conflicts if ^ isn't possible- how do you guys approach these multiple jQuery and java files that often butt heads? do you use noConflict or change the var names throughout the files?  What is the best strategy?

many thanks in advance.

Kindred

mods should all use noconflict at the very least
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

drewactual

turns out i didn't have a conflict at all... i had compression set to off in SMF and was doing it server side... using zlib_compression as opposed to output in the ini file, and it corrupted all the xmlhttprequests... so... turns out i can still use brotli, and gzip, and by simply setting the output handler to zlib and turning it over to SMF to compress..

the only gzip files are the index @ dns lookup, and the xmlhttprequests... everything else is brotli(br), and..... the page has all it's function and all it's speed back.

i've been looking for a JS conflict for literally two weeks that didn't exist.  it was all about corrupted compression.

drewactual

thank you for your response, kindred...

I now have a true conflict, but it should be a lot easier to find.... mentions doesn't offer the little drop down... not a big deal.

Advertisement: