Jump to content

Adding jQuery via Google CDN - issues with CCC


Recommended Posts

Hi,

 

I have opted to use the jQuery from Google's CDN instead of the local copy in the hopes of making the site load faster. The instructions on this page were followed:  http://www.prestadb.com/snippets/load-jquery-using-google-cdn/

 

When I have CCC "smart cache for javascript" turned off.  

The first .js file listed is jQuery as expected, followed by the others: 

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript">
<script src=".....>

Everything good so far.

 

But if I turn CCC on, the jQuery file is displayed after the combines .js files like this:

<script src="http://domain.com/cache/bunchofnumbersandstuff.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

As you know, the jQuery must be first in order to work properly... so how can I make it that the jQuery file is listed first before the combined .js file?

 

Thoughts?

Thank you.

Edited by utneflyte (see edit history)
Link to comment
Share on other sites

  • 3 months later...

A solution exist by ovveriding /classe/media

    public static function cccJS($js_files)
    {
       [...]
        return array_merge(array($protocol_link.Tools::getMediaServer($url).$url), $js_external_files);
    }

changed by

    public static function cccJS($js_files)
    {
       [...]
        return array_merge($js_external_files,array($protocol_link.Tools::getMediaServer($url).$url));
    }
Link to comment
Share on other sites

×
×
  • Create New...