Dispatch versioned assets.
composer require a3gz/assets-dispatcher
Please, check out the included demo.
The full sized assets don't need to be below
public_html; the PHP dispatcher will:
- Attempt to dispatch a minified version of the requested asset.
- If the above fails, look for the original non-minified file, create the minified version and dispatch the resulting file.
An alternative use we can have for Assets Dispatcher is that of an automated minifier. Please, take a look at
demo-alt for details.
In this setup, instead of using a PHP dispatcher to serve the assets, we use it to generate the minified versions of all the resources. In the
demo-alt we do this via a PHP file that we have to HTTP GET, but in a real situation we would use a cron job instead.