Releases: Brain-WP/Assets
v0.3.0
New "juicy" release with interesting new features. Thi is stricly-speacking a Breaking change since new methds are added to internal interfaces, but user-facing API is 100% backward compatible.
Added:
- Possibility to obtain the
Collection
of all assets registered/enqueued. This enables the possibility to act on existing assets both individually and collectively. See docs. - Allow deregister and dequeue t be done directly from the Assets class, including for assets not registered/enqueued via the Assets class itself
JsEnqueue::useStrategy()
to allow editing the "in_footer" strategy after registration/enqueueCollection::append()
,Collection::remove()
, and Collection::dequeue()- Added
Enqueue::deregister()
to theEnqueue
contract - Action hook fired on the registration, internally used to remove the assets from the Collection
Changed:
- Assets previoulsy registered via WP functions are deregistered to allow new registration via the library
- Improved tests and more consistency in code styles
v0.2.0
Big release, breaking changes in internal API
This release is almost a full re-write of the code, targeting WP 6.3+ and PHP 8.0+.
However, the "consumer API" is mostly unchanged and, unless consumers where customizing the internal objects extending classes or implementing interfaces, chances are the consuming code still work without issues.
There's only one breaking change for consuming code, and it regards the "minified" assets discovery, that is, assets with names ending in .min.css
or .min.js
which were previously discovered automatically. Considering this is not a common practice anymore, discovery of such files must be enabled explicitly via Assets::tryMinUrls()
(which also existed in v0.1, but it was enabled by default).
Besides this "edge case" all the previously-documented consuming API should work without changes.
But new features are now available:
- Support for the WP's dependency-extraction Webpack plugin (included when using
wp-scripts
) to automatically discover dependencies and version - Improved support for Webpack Manifest Plugin
manifest.json
- Support for the two above used in combination, for super-straightforward assets registration and enqueuing
- Support for assets registration separated from enqueuing
- Support for dequeing and deregistering
- Usage of native WP 6.3 new API for "async" and "defer" support for scripts