Extension to add hash values to asset filenames. This extension causes asset file types (images, scripts, stylesheets, etc) to have a unique identifier appended to their filename that consists of a hash of their contents. This extension also includes a Rack middleware that rewrites references to these assets in HTML, JavaScript, and CSS files, eliminating the need to use special helper functions to include modified filenames in references.

This commit is contained in:
Ben Hollis 2012-03-04 15:24:38 -08:00
parent c2f498e26e
commit 073086b79c
14 changed files with 822 additions and 1 deletions

View file

@ -35,6 +35,10 @@ module Middleman
# browser caches failing to update to your new content.
autoload :CacheBuster, "middleman-more/extensions/cache_buster"
# AssetHash appends a hash of the file contents to the assets filename
# to avoid browser caches failing to update to your new content.
autoload :AssetHash, "middleman-more/extensions/asset_hash"
# MinifyCss uses the YUI compressor to shrink CSS files
autoload :MinifyCss, "middleman-more/extensions/minify_css"
@ -65,4 +69,6 @@ module Middleman
::Middleman::Extensions::MinifyJavascript }
Extensions.register(:relative_assets) {
::Middleman::Extensions::RelativeAssets }
end
Middleman::Extensions.register(:asset_hash) {
Middleman::Extensions::AssetHash }
end