Assets Addon 1.2 for WP Offload S3 Released

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:

assets-1.1-manual-actions

When you clicked “Scan Now” it would reload the page and show a notice that scanning was happening in the background:

assets-1.1-scanning-status

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:

assets-1.2-advanced-options

Force HTTPS

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:

assets-1.2-force-https

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.

And More

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.

About the Author

Brad Touesnard

As founder of Delicious Brains Inc., Brad wears many hats; from coding and design, to marketing and partnerships. Before starting Delicious Brains, Brad was a busy freelance web developer, specializing in front-end development.

  • Raymond Pirouz

    With regard to “Force HTTPS” I am currently using the “SSL Insecure Content Fixer” plugin. If I activate Force HTTPS can I deactivate & remove “SSL Insecure Content Fixer” or is Force HTTPS limited specifically to WP Offload functions?

    • @Raymond that will depend on “how” the specific theme & your associated plugins are making http calls. You ‘might’ be able to disable that plugin, but it’s not a guarantee. If the theme / plugin is calling on something like font awesome (for example), by using http://link-to-font-awesome.com instead of https://link-to-font-awesome.com or (better yet) //link-to-font-awesome.com

      Anytime a theme or plugin has a dependency on something external like Font Awesome, a js library, a jquery library, or anything else, they **should** use the domain agnostic preference of //link-to-whatever.com

      Unfortunately, in your case, it sounds like a developer has **improperly** used some external source by hard-coding the —> http://whatever.com <— URL into your theme or plugin.

      If you select Force HTTPS in Delicious Brain's Delicious Asset's AddOn there's a strong chance that your site might break. But it's not Delicious Brain's Delicious AddOn, nor your fault either πŸ˜‰ It's the plugin / theme that needs to be fixed.

      • Raymond Pirouz

        Thanks for the detailed description — makes a lot of sense. Yep, theme with a ton of additional dependencies. πŸ™‚

  • Cantilever, Inc.

    Hey Brad, great updates! FYI the apply_filters sample code at the end has some curly quotes in it – it might cause you folks some erroneous support requests πŸ™‚