jekyll-assets 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.3.3 (2013-02-16)
2
+
3
+ * Respect cachebust setting on assets output filenames. (Thanks @softcrumbs)
4
+
5
+
1
6
  ### 0.3.2 (2013-02-10)
2
7
 
3
8
  * Allow choose cachebusting strategy (hard/soft/none). See #11.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://secure.travis-ci.org/ixti/jekyll-assets.png)](http://travis-ci.org/ixti/jekyll-assets)
4
4
  [![Dependency Status](https://gemnasium.com/ixti/jekyll-assets.png)](https://gemnasium.com/ixti/jekyll-assets)
5
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/ixti/jekyll-assets)
5
+ [![Code Climate](https://codeclimate.com/github/ixti/jekyll-assets.png)](https://codeclimate.com/github/ixti/jekyll-assets)
6
6
 
7
7
  Jekyll plugin, that adds Rails-alike assets pipeline, that means that:
8
8
 
@@ -14,7 +14,18 @@ module Jekyll
14
14
 
15
15
 
16
16
  def destination dest
17
- File.join(dest, @site.assets_config.dirname, @asset.digest_path)
17
+ File.join dest, @site.assets_config.dirname, filename
18
+ end
19
+
20
+
21
+ def filename
22
+ cachebust = @site.assets_config.cachebust
23
+
24
+ case cachebust
25
+ when :none, :soft then asset.logical_path
26
+ when :hard then asset.digest_path
27
+ else raise "Unknown cachebust strategy: #{cachebust.inspect}"
28
+ end
18
29
  end
19
30
 
20
31
 
@@ -19,6 +19,7 @@ module Jekyll
19
19
 
20
20
 
21
21
  autoload :ContextPatch, "jekyll/assets_plugin/environment/context_patch"
22
+ autoload :IndexPatch, "jekyll/assets_plugin/environment/index_patch"
22
23
 
23
24
 
24
25
  attr_reader :site
@@ -51,21 +52,7 @@ module Jekyll
51
52
 
52
53
 
53
54
  def index
54
- super.tap do |index|
55
- index.instance_eval do
56
- def find_asset path, options = {}
57
- site = @environment.site
58
- asset = super
59
- bundle = options[:bundle]
60
-
61
- if asset and bundle and not site.static_files.include? asset
62
- site.static_files << AssetFile.new(site, asset)
63
- end
64
-
65
- asset
66
- end
67
- end
68
- end
55
+ super.tap { |index| index.singleton_class.send :include, IndexPatch }
69
56
  end
70
57
 
71
58
  end
@@ -0,0 +1,21 @@
1
+ module Jekyll
2
+ module AssetsPlugin
3
+ class Environment
4
+ module IndexPatch
5
+
6
+ def find_asset path, options = {}
7
+ site = @environment.site
8
+ asset = super
9
+ bundle = options[:bundle]
10
+
11
+ if asset and bundle and not site.static_files.include? asset
12
+ site.static_files << AssetFile.new(site, asset)
13
+ end
14
+
15
+ asset
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -22,14 +22,15 @@ module Jekyll
22
22
 
23
23
 
24
24
  def asset_path *args
25
- asset = assets[*args]
26
- baseurl = "#{assets_config.baseurl}/"
25
+ asset = assets[*args]
26
+ baseurl = "#{assets_config.baseurl}/"
27
+ cachebust = assets_config.cachebust
27
28
 
28
- case assets_config.cachebust
29
+ case cachebust
29
30
  when :none then baseurl << asset.logical_path
30
31
  when :soft then baseurl << asset.logical_path << "?cb=#{asset.digest}"
31
32
  when :hard then baseurl << asset.digest_path
32
- else raise "Unknown cachebast strategy: #{assets_config.cachebust}"
33
+ else raise "Unknown cachebust strategy: #{cachebust.inspect}"
33
34
  end
34
35
  end
35
36
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AssetsPlugin
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
1
  @import "bourbon"
2
2
 
3
3
  .photo
4
- @include box-shadow(0 0 5px 0px hsla(0, 0%, 0%, 0.65))
4
+ @include linear-gradient(#1e5799, #2989d8)
@@ -1,4 +1,4 @@
1
1
  @import "compass"
2
2
 
3
3
  .photo
4
- @include single-box-shadow(#eee, 0px, 0px, 5px)
4
+ @include background-image(linear-gradient(#1e5799, #2989d8))
@@ -5,10 +5,7 @@ require "jekyll-assets/bourbon"
5
5
  module Jekyll::AssetsPlugin
6
6
  describe "Bourbon integration" do
7
7
  it "should globally append bourbon paths into Sprockets environment" do
8
- asset = @site.assets["vendor/bourbon.css"].to_s
9
-
10
- asset.should =~ /-webkit-box-shadow/
11
- asset.should =~ /box-shadow/
8
+ @site.assets["vendor/bourbon.css"].to_s.should =~ /linear-gradient/
12
9
  end
13
10
  end
14
11
  end
@@ -5,11 +5,7 @@ require "jekyll-assets/compass"
5
5
  module Jekyll::AssetsPlugin
6
6
  describe "Compass integration" do
7
7
  it "should globally append compass paths into Sprockets environment" do
8
- asset = @site.assets["vendor/compass.css"].to_s
9
-
10
- asset.should =~ /-webkit-box-shadow/
11
- asset.should =~ /-moz-box-shadow/
12
- asset.should =~ /box-shadow/
8
+ @site.assets["vendor/compass.css"].to_s.should =~ /linear-gradient/
13
9
  end
14
10
  end
15
11
  end
@@ -4,9 +4,31 @@ require "spec_helper"
4
4
  module Jekyll::AssetsPlugin
5
5
  describe AssetFile do
6
6
  context "#destination" do
7
- let(:file) { AssetFile.new(@site, @site.assets["app.css"]) }
8
- subject { file.destination @dest.to_s }
9
- it { should match %r{/app-[0-9a-f]{32}\.css$} }
7
+ subject do
8
+ AssetFile.new(@site, @site.assets["app.css"]).destination @dest.to_s
9
+ end
10
+
11
+ context "with none cachebust" do
12
+ before { @site.assets_config.cachebust = :none }
13
+ it { should match(%r{/app\.css$}) }
14
+ end
15
+
16
+ context "with soft cachebust" do
17
+ before { @site.assets_config.cachebust = :soft }
18
+ it { should match(%r{/app\.css$}) }
19
+ end
20
+
21
+ context "with hard cachebust" do
22
+ before { @site.assets_config.cachebust = :hard }
23
+ it { should match %r{/app-[0-9a-f]{32}\.css$} }
24
+ end
25
+
26
+ context "with unknown cachebust" do
27
+ before { @site.assets_config.cachebust = :wtf }
28
+ it "should raise error" do
29
+ expect { @site.asset_path "app.css" }.to raise_error
30
+ end
31
+ end
10
32
  end
11
33
  end
12
34
  end
@@ -63,21 +63,20 @@ module Jekyll::AssetsPlugin
63
63
 
64
64
 
65
65
  context "#asset_path" do
66
+ subject { site.asset_path "app.css" }
67
+
66
68
  context "with none cachebust" do
67
69
  before { site.assets_config.cachebust = :none }
68
- subject { site.asset_path "app.css" }
69
70
  it { should match(%r{^/assets/app\.css$}) }
70
71
  end
71
72
 
72
73
  context "with soft cachebust" do
73
74
  before { site.assets_config.cachebust = :soft }
74
- subject { site.asset_path "app.css" }
75
75
  it { should match(%r{^/assets/app\.css\?cb=[a-f0-9]{32}$}) }
76
76
  end
77
77
 
78
78
  context "with hard cachebust" do
79
79
  before { site.assets_config.cachebust = :hard }
80
- subject { site.asset_path "app.css" }
81
80
  it { should match(%r{^/assets/app-[a-f0-9]{32}\.css$}) }
82
81
  end
83
82
 
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.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-10 00:00:00.000000000 Z
12
+ date: 2013-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -167,6 +167,7 @@ files:
167
167
  - lib/jekyll/assets_plugin/configuration.rb
168
168
  - lib/jekyll/assets_plugin/environment.rb
169
169
  - lib/jekyll/assets_plugin/environment/context_patch.rb
170
+ - lib/jekyll/assets_plugin/environment/index_patch.rb
170
171
  - lib/jekyll/assets_plugin/filters.rb
171
172
  - lib/jekyll/assets_plugin/liquid_processor.rb
172
173
  - lib/jekyll/assets_plugin/renderer.rb
@@ -218,7 +219,7 @@ rubyforge_project:
218
219
  rubygems_version: 1.8.23
219
220
  signing_key:
220
221
  specification_version: 3
221
- summary: jekyll-assets-0.3.2
222
+ summary: jekyll-assets-0.3.3
222
223
  test_files:
223
224
  - spec/fixtures/.gitignore
224
225
  - spec/fixtures/_assets/app.css.erb