Sha256: 3c7e6390369f5ba300d8c3f55fcdf0eaacd73fb118eb7a221d646d09c5fb4423
Contents?: true
Size: 829 Bytes
Versions: 1
Compression:
Stored size: 829 Bytes
Contents
module AssetRevHelper REV_MANIFEST_FILE = 'public/rev-manifest.json'.freeze def rev_manifest_file Rails.root.join(REV_MANIFEST_FILE) end def rev_manifest? rev_manifest_file.exist? end def rev_manifest @rev_manifest ||= JSON.load(rev_manifest_file.read) end def path_to_asset(source, options = {}) path = super(source, options) asset_host = Rails.configuration.action_controller.asset_host.to_s # No rev manifest? Just return path. return File.join(asset_host, path) unless rev_manifest? # Remove asset_host from source, so we # can search for file on manifest. path = path.gsub(asset_host, '') # Try to find file on manifest; use path otherwise. path = rev_manifest[path[1..-1]] || path # Return the final url. File.join(asset_host, path) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gulp-rails-0.1.2 | templates/asset_rev_helper.rb |