Class: Middleman::Extensions::CacheBuster
- Inherits:
-
Middleman::Extension
- Object
- Middleman::Extension
- Middleman::Extensions::CacheBuster
- Defined in:
- middleman-core/lib/middleman-core/extensions/cache_buster.rb
Overview
The Cache Buster extension
Constant Summary
Constants included from Contracts
Instance Attribute Summary
Attributes inherited from Middleman::Extension
Instance Method Summary collapse
-
#initialize(app, options_hash = {}, &block) ⇒ CacheBuster
constructor
A new instance of CacheBuster.
- #rewrite_url(asset_path, _dirpath, _request_path) ⇒ Object
Methods inherited from Middleman::Extension
activated_extension, #add_exposed_to_context, #after_build, #after_configuration, #after_extension_activated, after_extension_activated, #before_build, #before_configuration, clear_after_extension_callbacks, config, define_setting, expose_to_application, expose_to_config, expose_to_template, global_config, helpers, #manipulate_resource_list, option, #ready, resources
Methods included from Contracts
Constructor Details
#initialize(app, options_hash = {}, &block) ⇒ CacheBuster
Returns a new instance of CacheBuster.
8 9 10 11 12 13 14 15 16 17 |
# File 'middleman-core/lib/middleman-core/extensions/cache_buster.rb', line 8 def initialize(app, ={}, &block) super app.rewrite_inline_urls id: :cache_buster, url_extensions: .exts || app.config[:asset_extensions], source_extensions: .sources, ignore: .ignore, rewrite_ignore: .rewrite_ignore, proc: method(:rewrite_url) end |
Instance Method Details
#rewrite_url(asset_path, _dirpath, _request_path) ⇒ Object
20 21 22 |
# File 'middleman-core/lib/middleman-core/extensions/cache_buster.rb', line 20 def rewrite_url(asset_path, _dirpath, _request_path) asset_path + '?' + Time.now.strftime('%s') end |