Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Small code cleanup

  • Loading branch information...
commit 96e194680e4a8fa06752ae3d3e7d23afd1b55868 1 parent 83292a5
Alexey Zapparov authored
16 lib/jekyll/assets_plugin/asset_file.rb
View
@@ -14,11 +14,17 @@ def initialize site, asset
def destination dest
- case @site.assets_config.cachebust
- when :none then File.join(dest, @site.assets_config.dirname, @asset.logical_path)
- when :soft then File.join(dest, @site.assets_config.dirname, @asset.logical_path)
- when :hard then File.join(dest, @site.assets_config.dirname, @asset.digest_path)
- else raise "Unknown cachebast strategy: #{@site.assets_config.cachebust}"
+ File.join dest, @site.assets_config.dirname, filename
+ end
+
+
+ def filename
+ cachebust = @site.assets_config.cachebust
+
+ case cachebust
+ when :none, :soft then asset.logical_path
+ when :hard then asset.digest_path
+ else raise "Unknown cachebust strategy: #{cachebust.inspect}"
end
end
9 lib/jekyll/assets_plugin/site_patch.rb
View
@@ -22,14 +22,15 @@ def assets
def asset_path *args
- asset = assets[*args]
- baseurl = "#{assets_config.baseurl}/"
+ asset = assets[*args]
+ baseurl = "#{assets_config.baseurl}/"
+ cachebust = assets_config.cachebust
- case assets_config.cachebust
+ case cachebust
when :none then baseurl << asset.logical_path
when :soft then baseurl << asset.logical_path << "?cb=#{asset.digest}"
when :hard then baseurl << asset.digest_path
- else raise "Unknown cachebast strategy: #{assets_config.cachebust}"
+ else raise "Unknown cachebust strategy: #{cachebust.inspect}"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.