Handling the same inline CSS across multiple pages and keeping original image file names

35 views
Skip to first unread message

Fred

unread,
Sep 21, 2017, 9:48:28 AM9/21/17
to mod-pagespeed-discuss
I am trying out page speed and have a few questions to see if the following options are available.
  1. I have a dynamic section on the web site that can be anywhere from 8 to 10 thousand pages; these pages are identical when it comes to the CSS files. When using inline css is there away to let the server handle these as one process rather than each time for each page?

    Or is there another option I should be using to handle CSS files to keep Google happy? Right now there are multiple CSS files be included which does not like.

  2. Is there are way to have page speed ignore optimizing all images except for images with a certain pattern? I don't like that when the images are optimized they are rewritten, I prefer to keep the original file names (at least for one image in particular).
Everything else I have resolved and would like to implement this plugin with one and two be resolved as well. Thanks Fred

Otto van der Schaaf

unread,
Sep 21, 2017, 10:19:54 AM9/21/17
to mod-pagesp...@googlegroups.com
Answered inline!

Otto

On Thu, Sep 21, 2017 at 3:48 PM Fred <fredm...@gmail.com> wrote:
I am trying out page speed and have a few questions to see if the following options are available.
  1. I have a dynamic section on the web site that can be anywhere from 8 to 10 thousand pages; these pages are identical when it comes to the CSS files. When using inline css is there away to let the server handle these as one process rather than each time for each page?

    Or is there another option I should be using to handle CSS files to keep Google happy? Right now there are multiple CSS files be included which does not like.

I am not 100% sure what you are asking here. But if you add ?PageSpeedFilters=+debug to the querystring, the module will add debug comments in the html to annotate it with any decisions it made around optimization. Perhaps inspecting those can help you here. If that doesn't help, could you post an example of the original css and the expected output from the module?

  1. Is there are way to have page speed ignore optimizing all images except for images with a certain pattern? I don't like that when the images are optimized they are rewritten, I prefer to keep the original file names (at least for one image in particular).

You can use allow/disallow to specify inclusion or exclusion pattterns:

Also, there is OptimizeForBandwidth mode which avoids changing urls altogether: https://www.modpagespeed.com/doc/optimize-for-bandwidth

 
Everything else I have resolved and would like to implement this plugin with one and two be resolved as well. Thanks Fred

--
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-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/55029414-f140-4a3f-8d14-c8c815afc304%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fred

unread,
Sep 21, 2017, 4:51:49 PM9/21/17
to mod-pagespeed-discuss
Thanks for the reply. I will check out the options "Restricting URLs" and "Optimize For Bandwidth" for the images. As for the inline CSS. Let me see about explaining it different rather than copying and pasting all that stylesheet code.

I noticed that when the module renders a page, it processes each page separately. Which is okay with what I am doing.

I just like to know if it is available that if page1.html, page2.html, page3.html and so on which all have identical stylesheets default.css, style.css, and responsive.css (as these are dynamic pages).

Rather than processing them again and again; once the first one is created and cached, the others using the same cache rather creating and wasting resources. If this was a dozen it wouldn't be a big deal, I am talking about thousands of pages all using the same inline.

What is the best coarse of action to save server processing resources.


On Thursday, September 21, 2017 at 10:19:54 AM UTC-4, Otto van der Schaaf wrote:
Answered inline!

Otto

On Thu, Sep 21, 2017 at 3:48 PM Fred <fredm...@gmail.com> wrote:
I am trying out page speed and have a few questions to see if the following options are available.
  1. I have a dynamic section on the web site that can be anywhere from 8 to 10 thousand pages; these pages are identical when it comes to the CSS files. When using inline css is there away to let the server handle these as one process rather than each time for each page?

    Or is there another option I should be using to handle CSS files to keep Google happy? Right now there are multiple CSS files be included which does not like.

I am not 100% sure what you are asking here. But if you add ?PageSpeedFilters=+debug to the querystring, the module will add debug comments in the html to annotate it with any decisions it made around optimization. Perhaps inspecting those can help you here. If that doesn't help, could you post an example of the original css and the expected output from the module?

  1. Is there are way to have page speed ignore optimizing all images except for images with a certain pattern? I don't like that when the images are optimized they are rewritten, I prefer to keep the original file names (at least for one image in particular).

You can use allow/disallow to specify inclusion or exclusion pattterns:

Also, there is OptimizeForBandwidth mode which avoids changing urls altogether: https://www.modpagespeed.com/doc/optimize-for-bandwidth
 
Everything else I have resolved and would like to implement this plugin with one and two be resolved as well. Thanks Fred

--
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.

Joshua Marantz

unread,
Sep 21, 2017, 4:54:22 PM9/21/17
to mod-pagespeed-discuss
What makes you think it is doing that work redundantly now?

Answered inline!

Otto

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.

--
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.

Fred

unread,
Sep 21, 2017, 5:03:02 PM9/21/17
to mod-pagespeed-discuss
When one of these pages have been processed and I view the source you can see the inline <style></style> styles that is required. If I load another page the inline is not there unless I reload the page (sometimes reloading takes 2 to 3 times) before it loads the inline styles.

I am assuming the module is processing the page again, is it not? And if it isn't, why wouldn't it just automatically detect and insert the identical cached inlines?


On Thursday, September 21, 2017 at 4:54:22 PM UTC-4, jmarantz wrote:
What makes you think it is doing that work redundantly now?
On Sep 21, 2017 4:51 PM, "Fred" <fredm...@gmail.com> wrote:
Thanks for the reply. I will check out the options "Restricting URLs" and "Optimize For Bandwidth" for the images. As for the inline CSS. Let me see about explaining it different rather than copying and pasting all that stylesheet code.

I noticed that when the module renders a page, it processes each page separately. Which is okay with what I am doing.

I just like to know if it is available that if page1.html, page2.html, page3.html and so on which all have identical stylesheets default.css, style.css, and responsive.css (as these are dynamic pages).

Rather than processing them again and again; once the first one is created and cached, the others using the same cache rather creating and wasting resources. If this was a dozen it wouldn't be a big deal, I am talking about thousands of pages all using the same inline.

What is the best coarse of action to save server processing resources.


On Thursday, September 21, 2017 at 10:19:54 AM UTC-4, Otto van der Schaaf wrote:
Answered inline!

Otto

On Thu, Sep 21, 2017 at 3:48 PM Fred <fredm...@gmail.com> wrote:
I am trying out page speed and have a few questions to see if the following options are available.
  1. I have a dynamic section on the web site that can be anywhere from 8 to 10 thousand pages; these pages are identical when it comes to the CSS files. When using inline css is there away to let the server handle these as one process rather than each time for each page?

    Or is there another option I should be using to handle CSS files to keep Google happy? Right now there are multiple CSS files be included which does not like.

I am not 100% sure what you are asking here. But if you add ?PageSpeedFilters=+debug to the querystring, the module will add debug comments in the html to annotate it with any decisions it made around optimization. Perhaps inspecting those can help you here. If that doesn't help, could you post an example of the original css and the expected output from the module?

  1. Is there are way to have page speed ignore optimizing all images except for images with a certain pattern? I don't like that when the images are optimized they are rewritten, I prefer to keep the original file names (at least for one image in particular).

You can use allow/disallow to specify inclusion or exclusion pattterns:

Also, there is OptimizeForBandwidth mode which avoids changing urls altogether: https://www.modpagespeed.com/doc/optimize-for-bandwidth
 
Everything else I have resolved and would like to implement this plugin with one and two be resolved as well. Thanks Fred

--
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/55029414-f140-4a3f-8d14-c8c815afc304%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joshua Marantz

unread,
Sep 21, 2017, 5:14:39 PM9/21/17
to mod-pagespeed-discuss
Good question.  I don't know offhand,   I don't think the HTML URL is part of the metadata cache key, but perhaps this is an interaction with combine_css, where any differences in the exact sequence of CSS files referenced will require the dependency graph to be recalculated.  Should be fast, though, as the leaf CSS files should be retained in the HTTP cache, and they are fast to parse and optimize.

I suspect if you have a few different HTML files, there may be some differences in the exact ordering of CSS files referenced.  One workaround would be to disable combine_css.

Another possibility is that your server-side cache is not working.  It's worth checking the Apache error log to see if you get file permission errors.



Answered inline!

Otto

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.

--
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+unsubscri...@googlegroups.com.

--
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.

Longinos

unread,
Sep 22, 2017, 3:59:23 AM9/22/17
to mod-pagespeed-discuss
Hi Jmarantz
I don´t think that Fred is talking about combine_css but inline_css. Pagespeed don´t cache the optimized html and in some pages the css is inlined and in others not.
The solution, I think, is to use a cache, like varnish, that store the optimized html or don´t inline css and serve css files optimized by pagespeed.

Is that, Fred?


Joshua Marantz

unread,
Sep 22, 2017, 8:48:24 AM9/22/17
to mod-pagespeed-discuss
If combine_css is enabled, it runs first, then minification & import-flattening, and finally inlining.  So if the set of CSS files going into a combination is different for a.html than b.html, it will need to do a little background computation to pull the parts together and cache the result, before determining whether the minified combination is small enough to inline.

If combine_css is disabled, then the minifying & inlining decisions will be made separately for each CSS file.


Anyway this is just speculation.  It's possible that all the pages have the exact same combinations and something is going wrong with the cache instead.


Fred: can you add ?PageSpeedFilters=+debug and look at the resulting HTML on first view for an HTML page whose results are not yet cached?

--
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.
Reply all
Reply to author
Forward
0 new messages