=== PhastPress === Tags: pagespeed insights, optimization, page speed, optimisation, speed, performance, load time, loadtime, images, css, webp, async, asynchronous, gtmetrix Requires at least: 4.4 Requires PHP: 5.6 Stable tag: trunk Tested up to: 5.4 License: AGPL-3.0 Contributors: apeschar PhastPress automatically optimizes your site for the best possible performance. == Description == PhastPress uses advanced techniques to manipulate your pages, scripts, stylesheets and images to significantly improve load times. It's designed to conform to Google PageSpeed Insights and GTmetrix recommendations and can improve your site's score dramatically. PhastPress' motto is _no configuration_. Install, activate and go! PhastPress has the Phast web page optimisation engine by [Albert Peschar](https://kiboit.com/) at its core. **Image optimization:** * Phast optimizes images using PNG quantization ([pngquant](https://pngquant.org/)) and JPEG recoding ([libjpeg-turbo](https://libjpeg-turbo.org/)). * Phast inlines small images (< 512 bytes) in the page. * Phast converts JPEG images into WebP for supporting browsers. **Asynchronous scripts and stylesheets:** * Phast loads all scripts on your page asynchronously and in a single request, while maintaining full compatibility with legacy scripts, due to our custom script loader. * Phast proxies external scripts to extend their cache lifetime. * Phast inlines critical CSS automatically by comparing the rules in your stylesheets with the elements on your page. * Phast loads non-critical CSS asynchronously and in a single request. * Phast inlines Google Fonts CSS. * Phast lazily loads IFrames to prioritize the main page load. Get the full power of Phast for your website by installing PhastPress now. **Experience any issues?** Please [contact me (Albert) on albert@peschar.net](mailto:albert@peschar.net). == Installation == 1. Upload the PhastPress plugin to your site and activate it. 2. Make sure that PhastPress is activated on the Settings page. 3. Test your site. If you experience any issues, please [contact me (Albert) on albert@peschar.net](mailto:albert@peschar.net). == Frequently Asked Questions == = Should I use other optimization plugins with PhastPress? = No. You do not need any other plugins, such as image optimization (e.g., Smush) or file minification (e.g., Autoptimize) after you install PhastPress, because PhastPress includes all necessary optimizations. I recommend using the simple combination of PhastPress and [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/) only. This reduces the potential for plugin conflicts, and it is really all you need. = Is PhastPress a caching plugin? Do you recommend another caching plugin? = No, PhastPress does not do caching. I recommend using [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/) in combination with PhastPress to speed up your server response time (TTFB). = Is PhastPress compatible with WP Fastest Cache? = Yes, but non-caching optimizations must be **disabled**. Turn off the WP Fastest Cache options in [this screenshot](https://peschar.net/s/yQVWIuOuI4ThfRZfkKJa/). = Is PhastPress compatible with W3 Total Cache? = Yes, but non-caching optimizations must be **disabled**. Specifically, the _Prevent caching of objects after settings change_ option causes problems. = Is PhastPress compatible with other caching plugins? = Yes. Some caching plugins include optimizations of JavaScript, CSS and/or images. I recommend turning off all optimizations to avoid conflicts with PhastPress. = PhastPress is enabled, but nothing happens = You might be using a plugin that compresses the page before PhastPress processes it. When that happens, PhastPress cannot apply optimizations. For example, if you are using the [Far Future Expiry Header](https://wordpress.org/plugins/far-future-expiry-header/) plugin, disable the option "Enable Gzip Compression". = Why does PhastPress not impact the "Fully Loaded Time" measured by GTmetrix? = The "Fully Loaded Time" in GTmetrix is the amount of time taken until all network activity ceases. This measurement can be misleading because it does not take into account the order in which resources load. Normally, external resources such as scripts and stylesheets must be downloaded, parsed and executed before the page can be rendered. PhastPress changes this sequence by including all necessary resources (that is, the critical CSS) in the page, and executing scripts asynchronously, so that they do not block the rendering of the page. This causes the page to be visible earlier in the browser, but does not change GTmetrix's fully loaded time. In order to see this effect, register and log in to GTmetrix and enable the "Video" option. Then test your site (with Phast enabled), and use the "Compare" button to again test your site, but while appending "?phast=-phast" to the URL (eg, https://example.com/?phast=-phast). When the comparison loads, select the "Filmstrips" tab and you'll see the difference. The Phast-optimized version of your site should start rendering much earlier. = Can I use a hook to disable PhastPress? = Should you need to disable PhastPress on certain pages, you can use the following code to do so: add_filter('phastpress_disable', '__return_true'); Make sure that this code runs during `template_redirect` or earlier. = Can I use disable PhastPress on WooCommerce checkout and cart pages? = Add this code to your theme's functions.php, or to a new file in wp-content/mu-plugins: add_filter('phastpress_disable', function ($disable) { return $disable || is_cart() || is_checkout(); }); = How and when does PhastPress clean the cache? = PhastPress uses filesize and modification time information to detect file changes, so clearing the cache is generally not needed. When you change a script or CSS file, the change should be visible immediately after reloading. If you do want to clear the cache, you can delete all the data inside `wp-content/cache/phastpress` or `wp-content/plugins/phastpress/cache`. = How do I exclude a specific script from optimization? = By default, PhastPress delays the load of all scripts until after the DOM has finished loading, so that the browser can render the page as quickly as possible. If you wish to load specific scripts as soon as possible, such as Google Analytics, you may add the `data-phast-no-defer` attribute to the script. It would be preferable to also mark external scripts as `async`, when possible. For example: Or: This is applied automatically for the Google Analytics script inserted by Monsterinsights since PhastPress 1.29. == Changelog == = 1.49 - 2020-05-14 = Phast was updated to version 1.46: * Whitelist `cdnjs.cloudflare.com` for CSS processing. = 1.48 - 2020-05-13 = Phast was updated to version 1.45: * Use `font-display: block` for icon fonts (currently Font Awesome, GeneratePress and Dashicons). = 1.47 - 2020-05-04 = Phast was updated to version 1.44: * Support `data-pagespeed-no-defer` and `data-cfasync="false"` attributes on scripts for disabling script deferral (in addition to `data-phast-no-defer`). * Leave `data-{phast,pagespeed}-no-defer` and `data-cfasync` attributes in place to aid debugging. = 1.46 - 2020-04-30 = Phast was updated to version 1.43: * Base64 encode the config JSON passed to the frontend, to stop Gtranslate or other tools from mangling the service URL that is contained in it. = 1.45 - 2020-04-15 = Phast was updated to version 1.42: * Speed up script load, and fix a bug with setTimeout functions running before the next script is loaded. = 1.44 = Phast was updated to version 1.41: * Support compressed external resources (ie, proxied styles and scripts). = 1.43 = * Image optimization functionality works again. You will have to re-enable it in the settings panel. Phast was updated to version 1.40: * Add s.pinimg.com, google-analytics.com/gtm/js to script proxy whitelist. = 1.42 = Phast was updated to version 1.39: * Remove blob script only after load. This fixes issues with scripts sometimes not running in Safari. = 1.41 = Phast was updated to version 1.38: * Fixed a regression causing external scripts to be executed out of order. = 1.40 = Phast was updated to version 1.37: * Execute scripts by inserting a `