| 1 |
=== Page Optimize === |
| 2 |
Contributors: aidvu, bjorsch, bpayton, mreishus, rcrdortiz |
| 3 |
Tags: performance |
| 4 |
Requires at least: 5.3 |
| 5 |
Tested up to: 7.0 |
| 6 |
Requires PHP: 7.4 |
| 7 |
Stable tag: 0.6.3 |
| 8 |
License: GPLv2 or later |
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 10 |
|
| 11 |
Optimize pages for faster load and render in the browser. |
| 12 |
|
| 13 |
== Description == |
| 14 |
|
| 15 |
This plugin supports a few features that may improve the performance of page loading and rendering in the browser: |
| 16 |
|
| 17 |
* Concatenate CSS |
| 18 |
* Concatenate JavaScript |
| 19 |
* Execution timing of non-critical scripts |
| 20 |
* Note: Changing script execution timing can be risky and will not work well for all sites. |
| 21 |
|
| 22 |
== Installation == |
| 23 |
|
| 24 |
This plugin uses sensible defaults so it can operate without configuration, but there are a number of constants you may use for a custom configuration. |
| 25 |
|
| 26 |
= PAGE_OPTIMIZE_CACHE_DIR = |
| 27 |
|
| 28 |
Page Optimize caches concatenated scripts and styles by default, and this constant controls where the cache files are stored. The default directory is `cache/page_optimize` under your site's `wp-content` folder. |
| 29 |
|
| 30 |
To change the cache location, set this constant to the absolute filesystem path of that location. |
| 31 |
|
| 32 |
To disable caching, set this constant to `false`. Please note that disabling Page Optimize caching may negatively impact performance unless you are caching elsewhere. |
| 33 |
|
| 34 |
= PAGE_OPTIMIZE_CSS_MINIFY = |
| 35 |
|
| 36 |
Page Optimize has CSS Minification capabilities which are off by default. |
| 37 |
|
| 38 |
If you're using caching, and not minifying CSS elsewhere, it is recommended to enable it by setting it to `true`. |
| 39 |
|
| 40 |
== Testing == |
| 41 |
|
| 42 |
To test features without enabling them for the entire site, you may append query params to a WordPress post or page URL. For example, to test enabling JavaScript concatenation for `https://example.com/blog/`, you can use the URL `https://example.com/blog/?concat-js=1`. |
| 43 |
|
| 44 |
Supported query params: |
| 45 |
|
| 46 |
* `concat-css` controls CSS concatenation. Values: `1` for ON and `0` for OFF. |
| 47 |
* `concat-js` controls JavaScript concatenation. Values: `1` for ON and `0` for OFF. |
| 48 |
* `load-mode-js` controls how non-critical JavaScript are loaded. Values: 'defer' for [deferred](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-defer), 'async' for [async loading](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async), any other value indicates the feature should be disabled. |
| 49 |
|
| 50 |
= PHPUnit (Docker) = |
| 51 |
|
| 52 |
You can run the PHPUnit tests locally using Docker (no local MySQL required). |
| 53 |
|
| 54 |
First time (or after changing DB credentials): |
| 55 |
|
| 56 |
`docker compose down -v` |
| 57 |
|
| 58 |
Run tests: |
| 59 |
|
| 60 |
`docker compose up --build --abort-on-container-exit --exit-code-from tests` |
| 61 |
|
| 62 |
Optional overrides (examples): |
| 63 |
|
| 64 |
* `WP_VERSION=6.5 docker compose up --build --abort-on-container-exit --exit-code-from tests` |
| 65 |
* `PHP_VERSION=7.4 docker compose up --build --abort-on-container-exit --exit-code-from tests` |
| 66 |
* `PHPUNIT_VERSION=9.6.20 docker compose up --build --abort-on-container-exit --exit-code-from tests` |
| 67 |
|
| 68 |
== Changelog == |
| 69 |
|
| 70 |
= 0.6.3 = |
| 71 |
* Update Tested up to version to 7.0 |
| 72 |
|
| 73 |
= 0.6.2 = |
| 74 |
* Fix: Harden CSS concat `@import` hoisting to preserve long Google Fonts-style URLs with semicolons and avoid false positives from `@import`-like substrings in rule bodies/URL paths. |
| 75 |
|
| 76 |
= 0.6.1 = |
| 77 |
* Fix: Skip JavaScript concatenation for scripts that request defer or async loading to preserve core loading behavior. |
| 78 |
* Fix: Skip JavaScript concatenation for module scripts (type="module") and scripts whose <script> tag is modified via the script_loader_tag filter (for example, plugins that add module attributes), improving compatibility. |
| 79 |
|
| 80 |
= 0.6.0 = |
| 81 |
* Fix: Preserve stylesheet enqueue/document order when concatenating CSS. Concat-eligible styles are now emitted as sequential runs and split around non-concatenated items (e.g. external/excluded/dynamic URLs), media changes, RTL handling, and other boundaries. |
| 82 |
* Fix: Inline styles (wp_add_inline_style) now print immediately after their parent stylesheet, including when styles are concatenated. |
| 83 |
* Fix: Apply core's style_loader_tag filter when a concatenation run contains only a single stylesheet (matching core behavior and the JS-side fix from 0.5.0). |
| 84 |
* Fix: The css_do_concat filter is now evaluated once per handle. |
| 85 |
* Fix: The concat service no longer drops @import directives due to a closure scoping bug. (@charset/@import handling now runs against the intended pre-output buffer.) |
| 86 |
* Fix: Stylesheets containing @import now start a new concat run so service-side @import hoisting cannot reorder imports ahead of earlier stylesheets. |
| 87 |
* Fix: Treat @import and @charset as case‑insensitive when building concatenated CSS, preventing missed rules in some stylesheets. |
| 88 |
|
| 89 |
= 0.5.8 = |
| 90 |
* Update Tested Up To Version to 6.9. |
| 91 |
|
| 92 |
= 0.5.7 = |
| 93 |
* Update Tested Up To Version to 6.8. |
| 94 |
|
| 95 |
= 0.5.6 = |
| 96 |
* Update Tested Up To version to 6.7. |
| 97 |
|
| 98 |
= 0.5.5 = |
| 99 |
* Fix: Stop skipping inline scripts when src is empty. |
| 100 |
|
| 101 |
= 0.5.4 = |
| 102 |
* Bail when editing pages or posts in the Editor. Increased the max concatenated file limit. |
| 103 |
|
| 104 |
= 0.5.1 = |
| 105 |
* Bail when editing pages in Brizy Editor (it errors when JavaScript load mode is `async`). |
| 106 |
|
| 107 |
= 0.5.0 = |
| 108 |
* Apply the `script_loader_tag` filter for scripts that are concatenate-able but have no neighbors to concatenate with. This fixes a case where the TwentyTwenty theme wanted to apply a `defer` attribute to its script but was never given the opportunity. |
| 109 |
|
| 110 |
= 0.4.5, 0.4.6 = |
| 111 |
* Force absolute paths for CSS replacements. |
| 112 |
* Lower required PHP version to 7.0. |
| 113 |
|
| 114 |
= 0.4.4 = |
| 115 |
* Don't queue the cache cleaning WP Cron job if we aren't caching. |
| 116 |
* Cleanup cache if we turned caching off or directory changed. |
| 117 |
|
| 118 |
= 0.4.3 = |
| 119 |
* gzip in PHP slows stuff down a bit. Simply don't do this. Any web server can handle this better. |
| 120 |
* also remove the output buffering, no need for that anymore |
| 121 |
* CSS Minification can sometimes slow things down significantly. Add constant to enable/disable. |
| 122 |
|
| 123 |
= 0.4.2 = |
| 124 |
* Initial release. No changes yet. :) |
| 125 |
|