jekyll-assets 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 0.3.8 (2013-04-29)
2
+
3
+ * Play nice with query strings and anchors in pathnames of requested assets.
4
+ See #20.
5
+
6
+
1
7
  ### 0.3.7 (2013-04-29)
2
8
 
3
9
  * Refactor AssetFile to avoid stale assets caching. See #23.
@@ -36,17 +36,24 @@ module Jekyll
36
36
  end
37
37
 
38
38
 
39
- def asset_path *args
40
- asset = assets[*args]
39
+ def asset_path pathname, *args
40
+ pathname, _, anchor = pathname.rpartition "#" if pathname["#"]
41
+ pathname, _, query = pathname.rpartition "?" if pathname["?"]
42
+
43
+ asset = assets[pathname, *args]
41
44
  baseurl = "#{assets_config.baseurl}/"
42
- cachebust = assets_config.cachebust
43
45
 
44
- case cachebust
46
+ case cachebust = assets_config.cachebust
45
47
  when :none then baseurl << asset.logical_path
46
48
  when :soft then baseurl << asset.logical_path << "?cb=#{asset.digest}"
47
49
  when :hard then baseurl << asset.digest_path
48
50
  else raise "Unknown cachebust strategy: #{cachebust.inspect}"
49
51
  end
52
+
53
+ baseurl << (:soft == cachebust ? "&" : "?") << query if query
54
+ baseurl << "#" << anchor if anchor
55
+
56
+ baseurl
50
57
  end
51
58
 
52
59
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AssetsPlugin
3
- VERSION = "0.3.7"
3
+ VERSION = "0.3.8"
4
4
  end
5
5
  end
File without changes
File without changes
File without changes
@@ -1 +1,11 @@
1
1
  /* vapor css framework */
2
+
3
+ @font-face {
4
+ font-family: 'Vapor';
5
+ src: url(font-path('fonts/vapor.eot'));
6
+ src: url(font-path('fonts/vapor.eot')#iefix) format("embedded-opentype"),
7
+ url(font-path('fonts/vapor.woff')) format("woff"),
8
+ url(font-path('fonts/vapor.ttf')) format("truetype");
9
+ font-weight: normal;
10
+ font-style: normal;
11
+ }
@@ -87,6 +87,46 @@ module Jekyll::AssetsPlugin
87
87
  expect { site.asset_path "app.css" }.to raise_error
88
88
  end
89
89
  end
90
+
91
+
92
+ context "with query part in requested filename" do
93
+ subject { site.asset_path "app.css?foo=bar" }
94
+
95
+ context "and none cachebust" do
96
+ before { site.assets_config.cachebust = :none }
97
+ it { should match(%r{^/assets/app\.css\?foo=bar$}) }
98
+ end
99
+
100
+ context "and soft cachebust" do
101
+ before { site.assets_config.cachebust = :soft }
102
+ it { should match(%r{^/assets/app\.css\?cb=[a-f0-9]{32}&foo=bar$}) }
103
+ end
104
+
105
+ context "and hard cachebust" do
106
+ before { site.assets_config.cachebust = :hard }
107
+ it { should match(%r{^/assets/app-[a-f0-9]{32}\.css\?foo=bar$}) }
108
+ end
109
+ end
110
+
111
+
112
+ context "with anchor part in requested filename" do
113
+ subject { site.asset_path "app.css#foobar" }
114
+
115
+ context "and none cachebust" do
116
+ before { site.assets_config.cachebust = :none }
117
+ it { should match(%r{^/assets/app\.css#foobar$}) }
118
+ end
119
+
120
+ context "and soft cachebust" do
121
+ before { site.assets_config.cachebust = :soft }
122
+ it { should match(%r{^/assets/app\.css\?cb=[a-f0-9]{32}#foobar$}) }
123
+ end
124
+
125
+ context "and hard cachebust" do
126
+ before { site.assets_config.cachebust = :hard }
127
+ it { should match(%r{^/assets/app-[a-f0-9]{32}\.css#foobar$}) }
128
+ end
129
+ end
90
130
  end
91
131
 
92
132
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -195,6 +195,9 @@ files:
195
195
  - spec/fixtures/.gitignore
196
196
  - spec/fixtures/_assets/app.css.erb
197
197
  - spec/fixtures/_assets/app.js
198
+ - spec/fixtures/_assets/fonts/vapor.eot
199
+ - spec/fixtures/_assets/fonts/vapor.ttf
200
+ - spec/fixtures/_assets/fonts/vapor.woff
198
201
  - spec/fixtures/_assets/noise.png
199
202
  - spec/fixtures/_assets/should_fail.css.erb
200
203
  - spec/fixtures/_assets/vapor.css
@@ -231,7 +234,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
234
  version: '0'
232
235
  segments:
233
236
  - 0
234
- hash: -2575730464667574048
237
+ hash: -1911320826109447063
235
238
  required_rubygems_version: !ruby/object:Gem::Requirement
236
239
  none: false
237
240
  requirements:
@@ -240,17 +243,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
243
  version: '0'
241
244
  segments:
242
245
  - 0
243
- hash: -2575730464667574048
246
+ hash: -1911320826109447063
244
247
  requirements: []
245
248
  rubyforge_project:
246
249
  rubygems_version: 1.8.23
247
250
  signing_key:
248
251
  specification_version: 3
249
- summary: jekyll-assets-0.3.7
252
+ summary: jekyll-assets-0.3.8
250
253
  test_files:
251
254
  - spec/fixtures/.gitignore
252
255
  - spec/fixtures/_assets/app.css.erb
253
256
  - spec/fixtures/_assets/app.js
257
+ - spec/fixtures/_assets/fonts/vapor.eot
258
+ - spec/fixtures/_assets/fonts/vapor.ttf
259
+ - spec/fixtures/_assets/fonts/vapor.woff
254
260
  - spec/fixtures/_assets/noise.png
255
261
  - spec/fixtures/_assets/should_fail.css.erb
256
262
  - spec/fixtures/_assets/vapor.css