jekyll-assets 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.md +5 -0
- data/lib/jekyll/assets_plugin/asset_path.rb +8 -13
- data/lib/jekyll/assets_plugin/patches/asset_patch.rb +6 -0
- data/lib/jekyll/assets_plugin/patches/site_patch.rb +8 -2
- data/lib/jekyll/assets_plugin/renderer.rb +11 -14
- data/lib/jekyll/assets_plugin/version.rb +1 -1
- metadata +3 -3
data/HISTORY.md
CHANGED
@@ -2,34 +2,29 @@ module Jekyll
|
|
2
2
|
module AssetsPlugin
|
3
3
|
class AssetPath
|
4
4
|
|
5
|
-
|
5
|
+
attr_writer :anchor, :query
|
6
6
|
|
7
7
|
|
8
|
-
def initialize
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@asset = site.assets[pathname, *args]
|
13
|
-
@site = site
|
14
|
-
|
15
|
-
site.bundle_asset! asset
|
8
|
+
def initialize asset
|
9
|
+
asset.bundle!
|
10
|
+
@asset = asset
|
16
11
|
end
|
17
12
|
|
18
13
|
|
19
14
|
def cachebust
|
20
|
-
@cachebust ||= @site.assets_config.cachebust
|
15
|
+
@cachebust ||= @asset.site.assets_config.cachebust
|
21
16
|
end
|
22
17
|
|
23
18
|
|
24
19
|
def path
|
25
|
-
:hard == cachebust && asset.digest_path || asset.logical_path
|
20
|
+
:hard == cachebust && @asset.digest_path || @asset.logical_path
|
26
21
|
end
|
27
22
|
|
28
23
|
|
29
24
|
def query
|
30
25
|
query = []
|
31
26
|
|
32
|
-
query << "cb=#{asset.digest}" if :soft == cachebust
|
27
|
+
query << "cb=#{@asset.digest}" if :soft == cachebust
|
33
28
|
query << @query if @query
|
34
29
|
|
35
30
|
"?#{query.join '&'}" unless query.empty?
|
@@ -42,7 +37,7 @@ module Jekyll
|
|
42
37
|
|
43
38
|
|
44
39
|
def to_s
|
45
|
-
"#{@site.assets_config.baseurl}/#{path}#{query}#{anchor}"
|
40
|
+
"#{@asset.site.assets_config.baseurl}/#{path}#{query}#{anchor}"
|
46
41
|
end
|
47
42
|
|
48
43
|
end
|
@@ -36,8 +36,14 @@ module Jekyll
|
|
36
36
|
end
|
37
37
|
|
38
38
|
|
39
|
-
def asset_path *args
|
40
|
-
|
39
|
+
def asset_path pathname, *args
|
40
|
+
pathname, _, anchor = pathname.rpartition "#" if pathname["#"]
|
41
|
+
pathname, _, query = pathname.rpartition "?" if pathname["?"]
|
42
|
+
|
43
|
+
AssetPath.new(assets[pathname, *args]).tap{ |ap|
|
44
|
+
ap.anchor = anchor
|
45
|
+
ap.query = query
|
46
|
+
}.to_s
|
41
47
|
end
|
42
48
|
|
43
49
|
|
@@ -24,27 +24,24 @@ module Jekyll
|
|
24
24
|
|
25
25
|
def render_javascript
|
26
26
|
@path << ".js" if File.extname(@path).empty?
|
27
|
-
|
28
|
-
if @site.assets_config.debug
|
29
|
-
return @site.assets[@path].to_a.map{ |a|
|
30
|
-
JAVASCRIPT % @site.asset_path(a.logical_path, :bundle => false)
|
31
|
-
}.join("\n")
|
32
|
-
end
|
33
|
-
|
34
|
-
JAVASCRIPT % render_asset_path
|
27
|
+
render_tag JAVASCRIPT
|
35
28
|
end
|
36
29
|
|
37
30
|
|
38
31
|
def render_stylesheet
|
39
32
|
@path << ".css" if File.extname(@path).empty?
|
33
|
+
render_tag STYLESHEET
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
protected
|
40
38
|
|
41
|
-
if @site.assets_config.debug
|
42
|
-
return @site.assets[@path].to_a.map{ |a|
|
43
|
-
STYLESHEET % @site.asset_path(a.logical_path, :bundle => false)
|
44
|
-
}.join("\n")
|
45
|
-
end
|
46
39
|
|
47
|
-
|
40
|
+
def render_tag template
|
41
|
+
asset = @site.assets[@path]
|
42
|
+
(@site.assets_config.debug ? asset.to_a : [asset]).map{ |a|
|
43
|
+
template % AssetPath.new(a).to_s
|
44
|
+
}.join("\n")
|
48
45
|
end
|
49
46
|
|
50
47
|
end
|
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.7.
|
4
|
+
version: 0.7.1
|
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-08-
|
12
|
+
date: 2013-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jekyll
|
@@ -249,7 +249,7 @@ rubyforge_project:
|
|
249
249
|
rubygems_version: 1.8.23
|
250
250
|
signing_key:
|
251
251
|
specification_version: 3
|
252
|
-
summary: jekyll-assets-0.7.
|
252
|
+
summary: jekyll-assets-0.7.1
|
253
253
|
test_files:
|
254
254
|
- spec/fixtures/.gitignore
|
255
255
|
- spec/fixtures/_assets/app.css.erb
|