Another awesome iteration of the Assets addon has arrived. In version 1.2, we’ve redesigned part of the UI to fix some of the things that have been irritating us. For the first release of the Assets addon, we just chucked the manual actions under the settings with very little thought:
When you clicked “Scan Now” it would reload the page and show a notice that scanning was happening in the background:
The page reload is not a great user experience, but even worse is having the status at the top of the settings page. This area is typically reserved for important errors and warnings that only show temporarily. By cluttering it with persistent messages that are not that important, all other messages in this space appear to be less important by association.
There is also no feedback that anything is happening. The notice just stays until the scan is complete and then shows a notice that it was complete on the next page reload. So the scan could be complete, but you just haven’t reloaded the page yet. This was a terrible user experience as many of our customers felt like scanning was stuck even when it wasn’t.
In version 1.2, we’ve combined the manual actions and status into a sidebar much like we did in the Media Library tab in version 1.1 of WP Offload S3:
As you can see, we no longer have any messages cluttering up the top of the settings page so anything that does show up there should be perceived as important again. The “Scan Now” and “Purge” actions both use AJAX now, so no more page reload. Plus every 5 seconds we check the status and update the UI if it has changed. I asked Ian why we don’t use the Heartbeat API and he explained:
Heartbeat has an interval that is not only too long, but also erratic as it slows down when nothing is happening. We need to see consistent progress, otherwise it looks like it’s not moving.
Exclude Files from Minify
Prior to this release you could exclude files from minify with a filter, but some found this a little annoying. So we added the option to the UI to list files to be excluded from minify:
Some of our customers have unique server setups where their assets load over regular HTTP when they should be loaded over HTTPS. For example:
We have a situation where our main site uses SSL and we use some middleware to rewrite our /blog URLs to go to our WordPress blog. So the URL looks like it’s on the same server when it’s not. This means it has an HTTPS URL and trying to load the assets over HTTP causes errors.
They need a way to force their assets to be served over HTTPS and so we added the option to the UI:
Get an Asset URL
Theme and plugin authors can now get the S3/CloudFront URL of an asset by using the
as3cf_get_asset filter. For example, you can now do the following in your themes/plugins:
<img src="<?php echo apply_filters( 'as3cf_get_asset', get_template_directory_uri() . '/assets/img/icon-twitter.svg’ ); ?>" alt="Twitter">
We pass the local URL of the image to our
as3cf_get_asset filter and if the image is ready to be served from S3/CloudFront, it returns the S3/CloudFront URL instead of the local URL. And because we’re using a filter, it will still work fine even if you deactivate WP Offload S3 and/or the Assets addon. See our documentation for more details.
Although the UI updates made for the bulk of the work in this release, there were a few minor changes and I suggest checking out the changelog for the full list.