Difficulties replacing js files with a combined file?

Discussion regarding Joomla! 2.5 Performance issues.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
lip420
Joomla! Guru
Joomla! Guru
Posts: 510
Joined: Thu Feb 17, 2011 6:13 am

Difficulties replacing js files with a combined file?

Post by lip420 » Fri Apr 18, 2014 5:41 am

I took the files mootools, core, caption, etc. out of the head of my template with this:

Code: Select all

$search = array('mootools', 'caption.js','core.js');
// remove the js files
foreach($this->_scripts as $key => $script) {
foreach($search as $findme) {
if(stristr($key, $findme) !== false) {
unset($this->_scripts[$key]);
}
}
}
I created a combined file with the same order as seen in the source called combined.js

Added this code:

Code: Select all

<script type="text/javascript" src="<?php echo $this->baseurl ?>/media/system/js/combined.js"></script>
And tried this one:

Code: Select all

<script type="text/javascript" src="/media/system/js/combined.js"></script>
But the combined js file wasn't working. Because the component that depends on mootools wasn't functioning. I know there is JCH optimize, but I want to do this without a component. Any ideas?

User avatar
NathanHawks
Joomla! Ace
Joomla! Ace
Posts: 1900
Joined: Wed Oct 02, 2013 6:17 pm
Location: Washington state, U.S.
Contact:

Re: Difficulties replacing js files with a combined file?

Post by NathanHawks » Thu May 29, 2014 3:34 pm

How did you finally solve this? If mod_pagespeed is an option, it works gorgeously... maintaining this by hand will bite you in the free time eventually.
Save time - hire me for your Joomla to-do list! http://nathanhawks.us/joomla

lip420
Joomla! Guru
Joomla! Guru
Posts: 510
Joined: Thu Feb 17, 2011 6:13 am

Re: Difficulties replacing js files with a combined file?

Post by lip420 » Thu May 29, 2014 4:30 pm

I didn't I just stuck with an extension that combined them.

itoctopus
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4025
Joined: Mon Nov 25, 2013 4:35 pm
Location: Montreal, Canada
Contact:

Re: Difficulties replacing js files with a combined file?

Post by itoctopus » Mon Jun 09, 2014 11:50 am

What's the name of the extension? Usually JS/CSS combining of files can result in an issue, even if you're using the best extension that does that which is JCH Optimize (that's why JCH Optimize allows you to exclude certain JS/CSS files from being combined).
http://www.itoctopus.com - Joomla consulting at its finest
https://twitter.com/itoctopus - Follow us on Twitter


Locked

Return to “Performance - Joomla! 2.5”