Permalink
Browse files

Small code cleanup

  • Loading branch information...
1 parent 83292a5 commit 96e194680e4a8fa06752ae3d3e7d23afd1b55868 @ixti ixti committed Feb 16, 2013
Showing with 16 additions and 9 deletions.
  1. +11 −5 lib/jekyll/assets_plugin/asset_file.rb
  2. +5 −4 lib/jekyll/assets_plugin/site_patch.rb
@@ -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
@@ -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

0 comments on commit 96e1946

Please sign in to comment.