Welcome! To use this support forum, please Login or Join Today!

   

Minify JS files

{name}
Rank

Total Posts: 30

Joined 2012-03-03

PM

 

Hi Casey,

Some time ago you were kind enough to write a child theme function to minify the Element and Synapse themes without the overhead of a plugin. Here’s the direct link to that forum topic.

I took a stab at a similar function to minify JS in Mobius. Here’s my child theme’s functions.php: http://hastebin.com/nerinewuco.php

It seems to work fine, but is this the optimal approach (i.e., is there anything you’d change)? Separately, is there any disadvantage to enqueuing these scripts in the footer as opposed to the head?

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

It looks right to me. Nice job. Enqueing in the footer can definitely speed up the initial page load, but I’d look out for JS errors when a slider is called via shortcode. It may be fine, but that’s where I’d test first because flexslider does load script within the body.

{name}
Rank

Total Posts: 30

Joined 2012-03-03

PM

 

Thanks so much for the quick reply and the heads-up on the slider script. I’ll definitely test it.

And Casey, Mobius looks awesome. You’ve done great work on it!