rel="preload" css tags with mod_pagespeed

627 views
Skip to first unread message

al...@cadence-labs.com

unread,
May 15, 2017, 12:24:40 PM5/15/17
to mod-pagespeed-discuss
Newer versions of mod_pagespeed will strip <link rel="preload" hints from the page and turn them into preload headers ... you can disable this feature, however doing so also disables pagespeed's ability to optimize the CSS.

If you are following this design pattern: https://github.com/filamentgroup/loadCSS of using rel="preload" to load non-critical css, this functionality results in the css getting stripped from the page content.

Is this intended behavior? 

Joshua Marantz

unread,
May 15, 2017, 12:43:13 PM5/15/17
to mod-pagespeed-discuss
Sorry I need to re-read the preload spec.  But isn't 'preload" a hint that requires that a non-preload link tag also exist?  If that's right, then MPS should not be changing behavior by stripping the preloads, though it may harm performance.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/3e821fe2-89cb-4ec4-92b9-9fe4f468f595%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

al...@cadence-labs.com

unread,
Jun 10, 2017, 3:26:46 PM6/10/17
to mod-pagespeed-discuss
The preload tag should be independent of non-preload tags. 

I think mod pagespeed is trying to take a <preload link tag and turn it into a preload header. This would be fine, but if you review my original post one way that google encourages async loading of non-critical CSS is to use <link preloads with javascript that turn them into normal <link tags upon completion

Adam Lane

unread,
Aug 24, 2017, 1:46:46 PM8/24/17
to mod-pagespeed-discuss
I am trying to use mod_pagespeed with loadCSS and having a problem I am unsure how to deal with:

The heart of the matter seems to be that I have preload link tags with onload attributes and mod_pagespeed is removing them so the onload never fires.  I just stumbled into this issue so I am totally guessing but I suspect the solution is that hint_preload_subresources should not remove a preload link tag if it has an onload attribute?

Otto van der Schaaf

unread,
Aug 25, 2017, 5:46:32 AM8/25/17
to mod-pagespeed-discuss
Reply all
Reply to author
Forward
0 new messages