Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Advanced page cache + minify

Started by Niko Kaindl 6 years ago · 1 replies · 674 views
6 years ago

It seems that the Minify Plugin does not work, if the Advanced page cache plugin is activated. Is there any possibility, to make both plugins work at the same time? Meaning First minify the page html and the give it over to the Advanced page cache.

I have seen the plugin prioritization (priorities.yaml) however I would not know how to configure it.

6 years ago

@NEA, UPDATE: After closer look at both plugins, and accidentally discovering the docs on plugin prioritisation.

Prioritising plugins:
The following configuration of the file '/user/config/priorities.yaml', sets the priority of the event-handler of Minify-HTML for event onOutputGenerated higher then AdvancedPageCache.

YAML
minify-html:              # name of plugin
  onOutputGenerated:      # name of event
    onOutputGenerated: 10 # name of function handling the event + priority

AdvancedPageCache will now cache the minified page.

Other optimisations: (for completeness' sake)
Before resorting to above plugins to squeeze the last bit of performance out if Grav, I presume you have already taken care of other performance techniques?

To name a few:

  • Using a workflow to:

    • Remove unused components (js + css) from css framework (Pure, Bootstrap ...)
    • Bundle/compile/minify scss + js into smaller bundles
    • Remove unused css from stylesheets using uncss or similar tools.
  • Loading critical css inline and rest of stylesheet asynchronously.

  • Using defer to load javascript asynchronously.

  • Optimizing images:

    • Cropping and compressing images.
    • Using srcset and sizes on <img> to load smaller images depending on expected display width of image.
  • Adding expiration headers on images, javascript and css to prevent browser to load resources unnecessarily.

  • Using GZip on server

  • Using HTTP/2 to increase load performance.

  • ...

last edited 07/26/20 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 48 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 72 2 months ago