jekyll-assets 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.rubocop.yml +30 -4
- data/.travis.yml +8 -1
- data/Gemfile +4 -0
- data/Gemfile.jekyll-1.0 +2 -0
- data/HISTORY.md +20 -0
- data/README.md +5 -0
- data/jekyll-assets.gemspec +6 -2
- data/lib/jekyll-assets.rb +1 -0
- data/lib/jekyll-assets/bootstrap.rb +1 -1
- data/lib/jekyll/assets_plugin/asset_path.rb +4 -2
- data/lib/jekyll/assets_plugin/configuration.rb +5 -5
- data/lib/jekyll/assets_plugin/filters.rb +1 -1
- data/lib/jekyll/assets_plugin/patches/processed_asset_patch.rb +2 -2
- data/lib/jekyll/assets_plugin/renderer.rb +1 -1
- data/lib/jekyll/assets_plugin/tag.rb +1 -1
- data/lib/jekyll/assets_plugin/version.rb +1 -1
- data/spec/lib/jekyll-assets/bootstrap_spec.rb +3 -5
- data/spec/lib/jekyll-assets/bourbon_spec.rb +3 -5
- data/spec/lib/jekyll-assets/compass_spec.rb +3 -5
- data/spec/lib/jekyll-assets/neat_spec.rb +3 -5
- data/spec/lib/jekyll/assets_plugin/configuration_spec.rb +125 -125
- data/spec/lib/jekyll/assets_plugin/environment_spec.rb +15 -13
- data/spec/lib/jekyll/assets_plugin/filters_spec.rb +75 -77
- data/spec/lib/jekyll/assets_plugin/patches/site_patch_spec.rb +130 -134
- data/spec/lib/jekyll/assets_plugin/renderer_spec.rb +32 -35
- data/spec/lib/jekyll/assets_plugin/tag_spec.rb +75 -77
- data/spec/spec_helper.rb +9 -4
- data/spec/support/fixtures_helpers.rb +7 -0
- metadata +89 -39
- checksums.yaml +0 -7
- data/spec/support/fixtures_path.rb +0 -11
data/.rubocop.yml
CHANGED
@@ -23,12 +23,30 @@ BlockNesting:
|
|
23
23
|
HashSyntax:
|
24
24
|
EnforcedStyle: hash_rockets
|
25
25
|
|
26
|
-
Encoding:
|
27
|
-
Enabled: false
|
28
|
-
|
29
26
|
StringLiterals:
|
30
27
|
EnforcedStyle: double_quotes
|
31
28
|
|
29
|
+
AlignParameters:
|
30
|
+
EnforcedStyle: with_fixed_indentation
|
31
|
+
|
32
|
+
IndentHash:
|
33
|
+
EnforcedStyle: consistent
|
34
|
+
|
35
|
+
PercentLiteralDelimiters:
|
36
|
+
PreferredDelimiters:
|
37
|
+
'%': ()
|
38
|
+
'%i': ()
|
39
|
+
'%q': ()
|
40
|
+
'%Q': ()
|
41
|
+
'%r': '{}'
|
42
|
+
'%s': ()
|
43
|
+
'%w': '[]'
|
44
|
+
'%W': '[]'
|
45
|
+
'%x': ()
|
46
|
+
|
47
|
+
Encoding:
|
48
|
+
Enabled: false
|
49
|
+
|
32
50
|
BracesAroundHashParameters:
|
33
51
|
Enabled: false
|
34
52
|
|
@@ -43,6 +61,14 @@ TrivialAccessors:
|
|
43
61
|
Lambda:
|
44
62
|
Enabled: false
|
45
63
|
|
64
|
+
# Ridiculous (and IMHO useless) restriction, that makes impossible aligning
|
65
|
+
# code like this:
|
66
|
+
#
|
67
|
+
# redis.hset :k1, now
|
68
|
+
# redis.hincrby :k2, 123
|
69
|
+
SingleSpaceBeforeFirstArg:
|
70
|
+
Enabled: false
|
71
|
+
|
46
72
|
AllCops:
|
47
|
-
|
73
|
+
Include:
|
48
74
|
- Gemfile
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.jekyll-1.0
ADDED
data/HISTORY.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
### 0.7.8 (2014-05-08)
|
2
|
+
|
3
|
+
* Support jekyll `~> 2.0`.
|
4
|
+
|
5
|
+
|
6
|
+
### 0.7.7 (2014-03-12)
|
7
|
+
|
8
|
+
* Allow purge cache by bumping assest config version.
|
9
|
+
|
10
|
+
|
11
|
+
### 0.7.6 (2014-02-22)
|
12
|
+
|
13
|
+
* Add `bootstrap-sass` support. See #75. (Thanks @adilsoncarvalho)
|
14
|
+
|
15
|
+
|
16
|
+
### 0.7.5 (2014-02-11)
|
17
|
+
|
18
|
+
* Fix `asset_path` error against empty srting. See #72. (Thanks @yaegashi)
|
19
|
+
|
20
|
+
|
1
21
|
### 0.7.4 (2013-10-25)
|
2
22
|
|
3
23
|
* Fix relative paths requires. See #59. (Thanks @wadetandy)
|
data/README.md
CHANGED
data/jekyll-assets.gemspec
CHANGED
@@ -23,15 +23,19 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.add_dependency "jekyll", "
|
26
|
+
spec.add_dependency "jekyll", ">= 1.0.0", "< 3.0.0"
|
27
27
|
spec.add_dependency "sprockets", "~> 2.10"
|
28
|
+
spec.add_dependency "sass"
|
28
29
|
|
29
30
|
spec.add_development_dependency "bundler", "~> 1.3"
|
30
31
|
spec.add_development_dependency "rake"
|
31
32
|
spec.add_development_dependency "rspec"
|
32
|
-
spec.add_development_dependency "guard-rspec"
|
33
33
|
spec.add_development_dependency "compass"
|
34
34
|
spec.add_development_dependency "bourbon"
|
35
35
|
spec.add_development_dependency "neat"
|
36
36
|
spec.add_development_dependency "bootstrap-sass"
|
37
|
+
|
38
|
+
# compass fails with SASS than 3.3+
|
39
|
+
# https://github.com/chriseppstein/compass/issues/1513
|
40
|
+
spec.add_development_dependency "sass", "~> 3.2.13"
|
37
41
|
end
|
data/lib/jekyll-assets.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "sprockets"
|
2
2
|
|
3
3
|
bootstrap = Gem::Specification.find_by_name("bootstrap-sass").gem_dir
|
4
|
-
%w
|
4
|
+
%w[fonts javascripts stylesheets].each do |asset|
|
5
5
|
Sprockets.append_path File.join(bootstrap, "vendor", "assets", asset)
|
6
6
|
end
|
@@ -20,9 +20,11 @@ module Jekyll
|
|
20
20
|
query = []
|
21
21
|
|
22
22
|
query << "cb=#{@asset.digest}" if :soft == cachebust
|
23
|
-
query << @query
|
23
|
+
query << @query if @query
|
24
24
|
|
25
|
-
|
25
|
+
return if query.empty?
|
26
|
+
|
27
|
+
"?" << query.join("&")
|
26
28
|
end
|
27
29
|
|
28
30
|
def anchor
|
@@ -6,14 +6,14 @@ module Jekyll
|
|
6
6
|
class Configuration
|
7
7
|
DEFAULTS = {
|
8
8
|
:dirname => "assets",
|
9
|
-
:sources => %w
|
10
|
-
|
11
|
-
|
9
|
+
:sources => %w[_assets/javascripts
|
10
|
+
_assets/stylesheets
|
11
|
+
_assets/images],
|
12
12
|
:js_compressor => nil,
|
13
13
|
:css_compressor => nil,
|
14
14
|
:cachebust => :hard,
|
15
15
|
:cache => false,
|
16
|
-
:gzip => %w
|
16
|
+
:gzip => %w[text/css application/javascript],
|
17
17
|
:debug => false,
|
18
18
|
:version => 1
|
19
19
|
}.freeze
|
@@ -53,7 +53,7 @@ module Jekyll
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def cache_assets?
|
56
|
-
|
56
|
+
@data.cache ? true : false
|
57
57
|
end
|
58
58
|
|
59
59
|
def cache_path
|
@@ -4,7 +4,7 @@ require "jekyll/assets_plugin/renderer"
|
|
4
4
|
module Jekyll
|
5
5
|
module AssetsPlugin
|
6
6
|
module Filters
|
7
|
-
%w
|
7
|
+
%w[asset asset_path image javascript stylesheet].each do |name|
|
8
8
|
module_eval <<-RUBY, __FILE__, __LINE__
|
9
9
|
def #{name} path # def stylesheet logical_path
|
10
10
|
r = Renderer.new @context, path # r = Renderer.new @context, path
|
@@ -13,10 +13,10 @@ module Jekyll
|
|
13
13
|
attr_reader :jekyll_assets
|
14
14
|
|
15
15
|
alias_method :__orig_build_dependency_paths,
|
16
|
-
|
16
|
+
:build_dependency_paths
|
17
17
|
|
18
18
|
alias_method :build_dependency_paths,
|
19
|
-
|
19
|
+
:__wrap_build_dependency_paths
|
20
20
|
|
21
21
|
alias_method :__orig_init_with, :init_with
|
22
22
|
alias_method :init_with, :__wrap_init_with
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "jekyll-assets/bootstrap"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@site.assets["bootstrap.css"].to_s.should =~ /bootstrap\//
|
8
|
-
end
|
4
|
+
describe "Bootstrap integration" do
|
5
|
+
it "should globally append bootstrap paths into Sprockets environment" do
|
6
|
+
@site.assets["bootstrap.css"].to_s.should =~ /bootstrap\//
|
9
7
|
end
|
10
8
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "jekyll-assets/bourbon"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@site.assets["vendor/bourbon.css"].to_s.should =~ /linear-gradient/
|
8
|
-
end
|
4
|
+
describe "Bourbon integration" do
|
5
|
+
it "should globally append bourbon paths into Sprockets environment" do
|
6
|
+
@site.assets["vendor/bourbon.css"].to_s.should =~ /linear-gradient/
|
9
7
|
end
|
10
8
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "jekyll-assets/compass"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@site.assets["vendor/compass.css"].to_s.should =~ /linear-gradient/
|
8
|
-
end
|
4
|
+
describe "Compass integration" do
|
5
|
+
it "should globally append compass paths into Sprockets environment" do
|
6
|
+
@site.assets["vendor/compass.css"].to_s.should =~ /linear-gradient/
|
9
7
|
end
|
10
8
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "jekyll-assets/neat"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@site.assets["vendor/neat.css"].to_s.should =~ /max-width/
|
8
|
-
end
|
4
|
+
describe "Neat integration" do
|
5
|
+
it "should globally append neat paths into Sprockets environment" do
|
6
|
+
@site.assets["vendor/neat.css"].to_s.should =~ /max-width/
|
9
7
|
end
|
10
8
|
end
|
@@ -1,166 +1,166 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
let(:config) { Configuration.new }
|
7
|
-
|
8
|
-
context "output assets dirname" do
|
9
|
-
subject { config.dirname }
|
10
|
-
it { should == Configuration::DEFAULTS[:dirname] }
|
11
|
-
end
|
3
|
+
describe Jekyll::AssetsPlugin::Configuration do
|
4
|
+
context "with defaults" do
|
5
|
+
let(:config) { described_class.new }
|
12
6
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
context "output assets dirname" do
|
8
|
+
subject { config.dirname }
|
9
|
+
it { should == described_class::DEFAULTS[:dirname] }
|
10
|
+
end
|
17
11
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
context "assets baseurl" do
|
13
|
+
subject { config.baseurl }
|
14
|
+
it { should == "/" + described_class::DEFAULTS[:dirname] }
|
15
|
+
end
|
22
16
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
context "sources list" do
|
18
|
+
subject { config.sources }
|
19
|
+
it { should =~ described_class::DEFAULTS[:sources] }
|
20
|
+
end
|
27
21
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
context "cachebust" do
|
23
|
+
subject { config.cachebust }
|
24
|
+
it { should == :hard }
|
25
|
+
end
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
context "js compressor" do
|
28
|
+
subject { config.js_compressor }
|
29
|
+
it { should be_nil }
|
30
|
+
end
|
37
31
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
context "css compressor" do
|
33
|
+
subject { config.css_compressor }
|
34
|
+
it { should be_nil }
|
35
|
+
end
|
42
36
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
context "gzip" do
|
38
|
+
subject { config.gzip }
|
39
|
+
it { should =~ %w[text/css application/javascript] }
|
40
|
+
end
|
47
41
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
42
|
+
context "cache_assets?" do
|
43
|
+
subject { config.cache_assets? }
|
44
|
+
it { should be_false }
|
45
|
+
end
|
52
46
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
context "cache_path" do
|
48
|
+
subject { config.cache_path }
|
49
|
+
it { should == ".jekyll-assets-cache" }
|
50
|
+
end
|
57
51
|
|
52
|
+
context "debug" do
|
53
|
+
subject { config.debug }
|
54
|
+
it { should be_false }
|
58
55
|
end
|
59
56
|
|
60
|
-
|
61
|
-
config = Configuration.new({
|
62
|
-
:sources => %w{abc},
|
63
|
-
:css_compressor => "sass"
|
64
|
-
})
|
57
|
+
end
|
65
58
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
59
|
+
it "should override specified options and leave defaults for missing" do
|
60
|
+
config = described_class.new({
|
61
|
+
:sources => %w[abc],
|
62
|
+
:css_compressor => "sass"
|
63
|
+
})
|
64
|
+
|
65
|
+
expect(config.dirname).to eq "assets"
|
66
|
+
expect(config.sources).to eq %w[abc]
|
67
|
+
expect(config.js_compressor).to be_nil
|
68
|
+
expect(config.css_compressor).to be :sass
|
69
|
+
end
|
71
70
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
71
|
+
context "#cache" do
|
72
|
+
context "when specified as String" do
|
73
|
+
it "should override default cache path" do
|
74
|
+
config = described_class.new :cache => "/tmp/jekyll-assets"
|
75
|
+
config.cache_path.should == "/tmp/jekyll-assets"
|
78
76
|
end
|
79
77
|
end
|
78
|
+
end
|
80
79
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
80
|
+
context "#baseurl" do
|
81
|
+
it "should respect explicit overrides" do
|
82
|
+
described_class.new({
|
83
|
+
:dirname => "foo",
|
84
|
+
:baseurl => "/bar/"
|
85
|
+
}).baseurl.should == "/bar"
|
86
|
+
end
|
88
87
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
end
|
88
|
+
it "should be auto-guessed from dirname" do
|
89
|
+
described_class.new({
|
90
|
+
:dirname => "foo"
|
91
|
+
}).baseurl.should == "/foo"
|
94
92
|
end
|
93
|
+
end
|
95
94
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
95
|
+
context "#js_compressor" do
|
96
|
+
context "when js compressor is given as `uglify`" do
|
97
|
+
let(:config) { described_class.new(:js_compressor => "uglify") }
|
98
|
+
subject { config.js_compressor }
|
99
|
+
it { should be :uglify }
|
100
|
+
end
|
102
101
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
102
|
+
context "otherwise" do
|
103
|
+
let(:config) { described_class.new }
|
104
|
+
subject { config.js_compressor }
|
105
|
+
it { should be_false }
|
108
106
|
end
|
107
|
+
end
|
109
108
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
109
|
+
context "#css_compressor" do
|
110
|
+
context "when css compressor is given as `sass`" do
|
111
|
+
let(:config) { described_class.new(:css_compressor => "sass") }
|
112
|
+
subject { config.css_compressor }
|
113
|
+
it { should be :sass }
|
114
|
+
end
|
116
115
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
end
|
116
|
+
context "otherwise" do
|
117
|
+
let(:config) { described_class.new }
|
118
|
+
subject { config.css_compressor }
|
119
|
+
it { should be_false }
|
122
120
|
end
|
121
|
+
end
|
123
122
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
end
|
123
|
+
context "#gzip" do
|
124
|
+
context "when gzip is disabled" do
|
125
|
+
let(:config) { described_class.new(:gzip => false) }
|
126
|
+
subject { config.gzip }
|
127
|
+
it { should == [] }
|
130
128
|
end
|
129
|
+
end
|
131
130
|
|
132
|
-
|
133
|
-
|
131
|
+
context "#version" do
|
132
|
+
subject { described_class.new(:version => version).version }
|
134
133
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
134
|
+
context "when given as 123" do
|
135
|
+
let(:version) { 123 }
|
136
|
+
it { should eq 123 }
|
137
|
+
it { should be_a Integer }
|
138
|
+
end
|
140
139
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
end
|
140
|
+
context "when given as 'abc'" do
|
141
|
+
let(:version) { "abc" }
|
142
|
+
it { should eq "abc" }
|
143
|
+
it { should be_a String }
|
146
144
|
end
|
145
|
+
end
|
147
146
|
|
148
|
-
|
149
|
-
|
150
|
-
let(:options) { { :compress => { :js => "uglify", :css => "sass" } } }
|
151
|
-
subject { Configuration.new options }
|
147
|
+
context "Deprecated options" do
|
148
|
+
subject(:config) { described_class.new options }
|
152
149
|
|
153
|
-
|
154
|
-
|
150
|
+
context "compress" do
|
151
|
+
let :options do
|
152
|
+
{ :compress => { :js => "uglify", :css => "sass" } }
|
155
153
|
end
|
156
154
|
|
157
|
-
|
158
|
-
|
155
|
+
its(:js_compressor) { should be :uglify }
|
156
|
+
its(:css_compressor) { should be :sass }
|
157
|
+
end
|
158
|
+
|
159
|
+
context "cache_assets" do
|
160
|
+
let(:options) { { :cache_assets => true } }
|
159
161
|
|
160
|
-
|
161
|
-
|
162
|
-
config.cache_assets?.should be_true
|
163
|
-
end
|
162
|
+
it "should set `cache` value" do
|
163
|
+
config.cache_assets?.should be_true
|
164
164
|
end
|
165
165
|
end
|
166
166
|
end
|