Advagg seems to be skipping JS in the header. The CSS is compressed and has a path /advagg_css/css__.....css
Then the JS is not in /advagg_js/ but instead /sites/deafault/files/js/ and it is not compressed

header

Then there is more JS in the footer which is compressed and in the correct path

footer

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plinto created an issue. See original summary.

mikeytown2’s picture

What theme are you using?

plinto’s picture

I am using a subtheme of Adaptive theme 7.x-3.4

plinto’s picture

Issue summary: View changes
mikeytown2’s picture

Which sub theme? I test with adaptive theme on a regular basis. The template.php file from the sub theme is where the problem is most likely.

plinto’s picture

I am using a custom sub-theme generated from the adaptive theme sub-theme ( at_subtheme).

I've looked at my templete.php but don't see anything strange.

I did notice that all js in the footer (which is correctly aggregated) has the scope defined to footer (drupal_add_js(libraries_get_path('flip').'/dist/jquery.flip.min.js', array('type' => 'file', 'scope' => 'footer'));). All scripts that have the scope set to header, or not set do not get aggregated by advagg.

E.g.

The picture module set the scope of it's js as footer, so it is aggregated in the footer.
The fancybox module does not set the scope so it is in the header /sites/default/files/js/...

I am also loading 3 js scripts from the .info file (scripts[] = ../../libraries/object-fit-images/dist/ofi.browser.js) and the script is in the header

plinto’s picture

I think I found the issue:

function XXXXXXX_process_html(&$vars) {
    .....
    // add jqueryui tabs
    drupal_add_library('system', 'ui.tabs');
    $vars['scripts'] = drupal_get_js();
    ......
}

It seems removing this from the template.php solved the problem

Thanks for the help!

mikeytown2’s picture

Title: JS in header not compressed » JS in header not aggregated by advagg. Theme overwriting $vars['scripts'] in template.php
Category: Bug report » Support request
Status: Active » Closed (works as designed)
mikeytown2’s picture

Status: Closed (works as designed) » Active
mikeytown2’s picture

Status: Active » Needs review
FileSize
578 bytes

  • mikeytown2 committed 9122416 on 7.x-2.x
    Issue #2896853 by mikeytown2: Add _advagg_process_html to end of process...
mikeytown2’s picture

Status: Needs review » Fixed

If you rename that function to XXXXXXX_preprocess_html and remove $vars['scripts'] = drupal_get_js(); it should work as expected.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.