Plugin Directory

Asset Helper

Author: Kenn Wilson / Corvid Works

Asset Helper brings Rails-style asset helper functions to Wordpress. The provided functions are:

  • stylesheet_tag()
  • javascript_tag()
  • image_tag()

At their most basic, these functions create the appropriate HTML tags for the supplied arguments. The benefit comes from the additional features of these functions: timestamping and asset hosts.

Timestamping

Each resulting HTML tag will include a Unix timestamp representing the last-modified time of the file. For example:

<img src="/path/to/image.jpg?1234567890" alt="" />

This allows you to set a far-future expires time for your static files while ensuring that if these files do change, browsers will always get the updated version, while keeping them cached otherwise.

Asset Hosts

This plugin also allows for static file hosts. If you have one defined, the resulting HTML tags will include complete URLs pointing to the files on your static file server. For example:

<img src="http://static.example.com/path/to/image.jpg?1234567890" alt="" />

To define a static asset host, place the following line in wp-config.php:

define('ASSET_HOST', 'static.example.com');

Don't worry about including "http://" or "https://" -- The plugin will automatically use whichever one is used for the page the functions appear on.

Download

FYI

Compatibility beta

Your Setup

Log in to vote.

The Consensus

No data

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(1 ratings)