jekyll-assets 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/jekyll/assets.rb +11 -15
- data/lib/jekyll/assets/addons/bootstrap.rb +3 -1
- data/lib/jekyll/assets/addons/fontawesome.rb +3 -1
- data/lib/jekyll/assets/env.rb +4 -3
- data/lib/jekyll/assets/helpers.rb +74 -0
- data/lib/jekyll/assets/liquid/drop.rb +6 -0
- data/lib/jekyll/assets/liquid/tag.rb +5 -5
- data/lib/jekyll/assets/liquid/tag/proxied_asset.rb +11 -1
- data/lib/jekyll/assets/processors/less.rb +2 -2
- data/lib/jekyll/assets/processors/liquid.rb +1 -1
- data/lib/jekyll/assets/version.rb +1 -1
- metadata +3 -24
- data/lib/jekyll/assets/addons.rb +0 -5
- data/lib/jekyll/assets/hooks.rb +0 -18
- data/lib/jekyll/assets/hooks/helpers.rb +0 -13
- data/lib/jekyll/assets/liquid.rb +0 -15
- data/lib/jekyll/assets/patches.rb +0 -10
- data/lib/jekyll/assets/patches/sprockets/helpers.rb +0 -31
- data/lib/jekyll/assets/processors.rb +0 -1
- data/lib/jekyll/assets/proxies.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a9af72c69bf187c13262a1c40b58438cc756986
|
4
|
+
data.tar.gz: 26f6fb75cbc6dd8f708dcbcee9e073a6537acd32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d890e1af9866a98ea85418e0a0ab9bb161f665f8a305d7cc940a837adaf4b29ff5b3beceb585abce36de678b4a38419ecb3c4461f964006e9f4ac70468402f7
|
7
|
+
data.tar.gz: 6cde01d5b5df8579c015d88d874426e79a65c5e4ac12cb514558ddfaf41da975bd3619df93b65e67b399ec62477c981520f096422093418e41d48118102efb6a
|
data/README.md
CHANGED
@@ -250,9 +250,9 @@ end
|
|
250
250
|
|
251
251
|
* CSS Auto Prefixer - add "autoprefixer-rails" to your Gemfile.
|
252
252
|
* ES6 Transpiler (through Babel) - add "sprockets-es6" to your Gemfile.
|
253
|
+
* Bootstrap - add "bootstrap-sass" to your Gemfile, and `@import 'boostrap-sprockets'; @import 'bootstrap'`
|
254
|
+
* Font Awesome - add "font-awesome-sass" to your Gemfile, and `@import 'font-awesome-sprockets'; @import 'font-awesome'`
|
253
255
|
* Image Magick - add "mini_magick" to your Gemfile, only works with `img`, `image`.
|
254
|
-
* Bootstrap - add "bootstrap-sass" to your Gemfile and "@import 'bootstrap'"
|
255
|
-
* Font Awesome - add "font-awesome-sass" to your Gemfile.
|
256
256
|
* LESS - add "less" to your Gemfile
|
257
257
|
|
258
258
|
***Please note that some of these (if not all) have trouble with Rhino --
|
data/lib/jekyll/assets.rb
CHANGED
@@ -1,24 +1,20 @@
|
|
1
|
-
# ----------------------------------------------------------------------------
|
2
1
|
# Frozen-string-literal: true
|
3
2
|
# Copyright: 2012 - 2016 - MIT License
|
4
3
|
# Encoding: utf-8
|
5
|
-
# ----------------------------------------------------------------------------
|
6
4
|
|
7
5
|
require "sprockets"
|
8
6
|
require "extras/all"
|
9
7
|
require "pathutil"
|
10
8
|
require "jekyll"
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
require_relative "assets/manifest"
|
24
|
-
require_relative "assets/proxies"
|
10
|
+
requires = [ :liquid,
|
11
|
+
:patches, "", :hooks, :addons,
|
12
|
+
:proxies, :processors
|
13
|
+
]
|
14
|
+
|
15
|
+
requires.each do |part|
|
16
|
+
Pathutil.new(File.expand_path("../", __FILE__)).join("assets", part.to_s)
|
17
|
+
.glob("{*,**/*}.rb").map(&method(
|
18
|
+
:require
|
19
|
+
))
|
20
|
+
end
|
data/lib/jekyll/assets/env.rb
CHANGED
@@ -20,8 +20,8 @@ module Jekyll
|
|
20
20
|
def init(jekyll)
|
21
21
|
new(jekyll)
|
22
22
|
jekyll.sprockets.excludes.map(&jekyll.config["exclude"].method(:<<))
|
23
|
-
jekyll.config["keep_files"] |= jekyll.sprockets.asset_config["prefix"]
|
24
|
-
|
23
|
+
jekyll.config["keep_files"] |= jekyll.sprockets.asset_config["prefix"].gsub(/\A\//, "").to_a
|
24
|
+
jekyll.config["exclude"].uniq!
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -208,7 +208,8 @@ module Jekyll
|
|
208
208
|
|
209
209
|
def write_all
|
210
210
|
assets = all_assets.partition { |v| v.is_a?(Liquid::Tag::ProxiedAsset) }
|
211
|
-
|
211
|
+
writeable_assets = assets.last.map(&:dependencies).push(assets.last).reduce(&:|)
|
212
|
+
manifest.compile(writeable_assets.map(&:logical_path))
|
212
213
|
|
213
214
|
assets.first.map do |asset|
|
214
215
|
asset.write_to(jekyll.in_dest_dir(File.join(asset_config["prefix"],
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module Assets
|
3
|
+
module Helpers
|
4
|
+
extend Forwardable::Extended
|
5
|
+
rb_delegate :manifest, {
|
6
|
+
:to => :parent
|
7
|
+
}
|
8
|
+
|
9
|
+
# --
|
10
|
+
# @param [String] path the path you wish to resolve.
|
11
|
+
# Find the path to the asset.
|
12
|
+
# --
|
13
|
+
def asset_path(path, opts = {})
|
14
|
+
return path if Pathname.new(path).absolute?
|
15
|
+
asset = manifest.find(path).first
|
16
|
+
|
17
|
+
if asset
|
18
|
+
parent.used.add(asset)
|
19
|
+
parent.prefix_path(
|
20
|
+
parent.digest?? asset.digest_path : asset.logical_path
|
21
|
+
)
|
22
|
+
else
|
23
|
+
path
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# --
|
28
|
+
# @param [String] path the path you wish to resolve.
|
29
|
+
# Pull the asset path and wrap it in url().
|
30
|
+
# --
|
31
|
+
def asset_url(path, opts = {})
|
32
|
+
"url(#{asset_path(
|
33
|
+
path, opts
|
34
|
+
)})"
|
35
|
+
end
|
36
|
+
|
37
|
+
# --
|
38
|
+
# Get access to the actual asset environment.
|
39
|
+
# @return [Jekyll::Assets::Env]
|
40
|
+
# --
|
41
|
+
def parent
|
42
|
+
environment.is_a?(Cached) ? environment.parent : environment
|
43
|
+
end
|
44
|
+
|
45
|
+
# --
|
46
|
+
# Creates font_url, font_path, image_path, image_url,
|
47
|
+
# img_path, and img_url for your pleasure.
|
48
|
+
# --
|
49
|
+
%W(font image img).each do |key|
|
50
|
+
define_method "#{key}_path" do |*args|
|
51
|
+
asset_path(
|
52
|
+
*args
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
|
58
|
+
define_method "#{key}_url" do |*args|
|
59
|
+
asset_url(
|
60
|
+
*args
|
61
|
+
)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
#
|
69
|
+
|
70
|
+
module Sprockets
|
71
|
+
class Context
|
72
|
+
prepend Jekyll::Assets::Helpers
|
73
|
+
end
|
74
|
+
end
|
@@ -33,6 +33,12 @@ module Jekyll
|
|
33
33
|
|
34
34
|
# --------------------------------------------------------------------
|
35
35
|
|
36
|
+
def integrity
|
37
|
+
return asset.integrity
|
38
|
+
end
|
39
|
+
|
40
|
+
# --------------------------------------------------------------------
|
41
|
+
|
36
42
|
def width
|
37
43
|
if image?
|
38
44
|
dimensions.first
|
@@ -52,9 +52,9 @@ module Jekyll
|
|
52
52
|
# --------------------------------------------------------------------
|
53
53
|
|
54
54
|
Tags = {
|
55
|
-
"css" => %(<link type="text/css" rel="stylesheet" href="%s"%s>),
|
56
|
-
"js" => %(<script type="text/javascript" src="%s"%s></script>),
|
57
|
-
"img" => %(<img src="%s"%s>)
|
55
|
+
"css" => %(<link type="text/css" rel="stylesheet" href="%s" integrity="%s"%s>),
|
56
|
+
"js" => %(<script type="text/javascript" src="%s" integrity="%s"%s></script>),
|
57
|
+
"img" => %(<img src="%s" integrity="%s"%s>)
|
58
58
|
}.freeze
|
59
59
|
|
60
60
|
# --------------------------------------------------------------------
|
@@ -126,8 +126,8 @@ module Jekyll
|
|
126
126
|
def build_html(args, sprockets, asset, path = get_path(sprockets, asset))
|
127
127
|
return path if @tag == "asset_path"
|
128
128
|
return asset.to_s if @tag == "asset" || @tag == "asset_source"
|
129
|
-
|
130
|
-
format(Tags[@tag],
|
129
|
+
data = args.key?(:data) && args[:data].key?(:uri) ? asset.data_uri : path
|
130
|
+
format(Tags[@tag], data, asset.integrity, args.to_html)
|
131
131
|
end
|
132
132
|
|
133
133
|
# --------------------------------------------------------------------
|
@@ -35,6 +35,14 @@ module Jekyll
|
|
35
35
|
|
36
36
|
# ------------------------------------------------------------------
|
37
37
|
|
38
|
+
def integrity
|
39
|
+
Sprockets::DigestUtils.integrity_uri(
|
40
|
+
digest
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
# ------------------------------------------------------------------
|
45
|
+
|
38
46
|
def cached?
|
39
47
|
@_cached
|
40
48
|
end
|
@@ -63,7 +71,9 @@ module Jekyll
|
|
63
71
|
# ------------------------------------------------------------------
|
64
72
|
|
65
73
|
def digest
|
66
|
-
Digest::SHA2.hexdigest(
|
74
|
+
Digest::SHA2.hexdigest(
|
75
|
+
args.proxies.to_s
|
76
|
+
)
|
67
77
|
end
|
68
78
|
|
69
79
|
# ------------------------------------------------------------------
|
@@ -34,10 +34,10 @@ module Jekyll
|
|
34
34
|
# --------------------------------------------------------------------
|
35
35
|
|
36
36
|
def self.patch_tree(tree, context)
|
37
|
-
|
37
|
+
Helpers.instance_methods.each do |m|
|
38
38
|
tree.functions[m.to_s.tr("_", "-")] = tree.functions[m.to_s] = lambda do |*args|
|
39
39
|
args.last.tap do |o|
|
40
|
-
o[:quote] = ""
|
40
|
+
o[:quote] = ""
|
41
41
|
o[:value] = context.send(m, args.last.toCSS().gsub(
|
42
42
|
/^"|"$/, ""
|
43
43
|
))
|
@@ -10,7 +10,7 @@ module Jekyll
|
|
10
10
|
# --------------------------------------------------------------------
|
11
11
|
|
12
12
|
def self.call(context, jekyll = context[:environment].jekyll)
|
13
|
-
if context[:environment].parent.asset_config["features"]["liquid"] ||
|
13
|
+
if context[:environment].parent.asset_config["features"]["liquid"] ||
|
14
14
|
File.extname(context[:filename]) == ".liquid"
|
15
15
|
|
16
16
|
payload_ = jekyll.site_payload
|
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: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordon Bedwell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-04-
|
13
|
+
date: 2016-04-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sprockets
|
@@ -26,20 +26,6 @@ dependencies:
|
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '3.3'
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: sprockets-helpers
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
33
|
-
- - "~>"
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: '1.2'
|
36
|
-
type: :runtime
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - "~>"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '1.2'
|
43
29
|
- !ruby/object:Gem::Dependency
|
44
30
|
name: fastimage
|
45
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,7 +154,6 @@ files:
|
|
168
154
|
- Rakefile
|
169
155
|
- lib/jekyll-assets.rb
|
170
156
|
- lib/jekyll/assets.rb
|
171
|
-
- lib/jekyll/assets/addons.rb
|
172
157
|
- lib/jekyll/assets/addons/autoprefixer.rb
|
173
158
|
- lib/jekyll/assets/addons/bootstrap.rb
|
174
159
|
- lib/jekyll/assets/addons/fontawesome.rb
|
@@ -177,13 +162,12 @@ files:
|
|
177
162
|
- lib/jekyll/assets/cached.rb
|
178
163
|
- lib/jekyll/assets/config.rb
|
179
164
|
- lib/jekyll/assets/env.rb
|
165
|
+
- lib/jekyll/assets/helpers.rb
|
180
166
|
- lib/jekyll/assets/hook.rb
|
181
|
-
- lib/jekyll/assets/hooks.rb
|
182
167
|
- lib/jekyll/assets/hooks/cache.rb
|
183
168
|
- lib/jekyll/assets/hooks/compression.rb
|
184
169
|
- lib/jekyll/assets/hooks/config.rb
|
185
170
|
- lib/jekyll/assets/hooks/erb.rb
|
186
|
-
- lib/jekyll/assets/hooks/helpers.rb
|
187
171
|
- lib/jekyll/assets/hooks/jekyll/drops.rb
|
188
172
|
- lib/jekyll/assets/hooks/jekyll/setup.rb
|
189
173
|
- lib/jekyll/assets/hooks/jekyll/write.rb
|
@@ -191,7 +175,6 @@ files:
|
|
191
175
|
- lib/jekyll/assets/hooks/sources.rb
|
192
176
|
- lib/jekyll/assets/hooks/sprockets.rb
|
193
177
|
- lib/jekyll/assets/hooks/version.rb
|
194
|
-
- lib/jekyll/assets/liquid.rb
|
195
178
|
- lib/jekyll/assets/liquid/drop.rb
|
196
179
|
- lib/jekyll/assets/liquid/filters.rb
|
197
180
|
- lib/jekyll/assets/liquid/tag.rb
|
@@ -202,15 +185,11 @@ files:
|
|
202
185
|
- lib/jekyll/assets/liquid/tag/proxies.rb
|
203
186
|
- lib/jekyll/assets/logger.rb
|
204
187
|
- lib/jekyll/assets/manifest.rb
|
205
|
-
- lib/jekyll/assets/patches.rb
|
206
188
|
- lib/jekyll/assets/patches/jekyll/site.rb
|
207
189
|
- lib/jekyll/assets/patches/kernel.rb
|
208
190
|
- lib/jekyll/assets/patches/sprockets/asset.rb
|
209
|
-
- lib/jekyll/assets/patches/sprockets/helpers.rb
|
210
|
-
- lib/jekyll/assets/processors.rb
|
211
191
|
- lib/jekyll/assets/processors/less.rb
|
212
192
|
- lib/jekyll/assets/processors/liquid.rb
|
213
|
-
- lib/jekyll/assets/proxies.rb
|
214
193
|
- lib/jekyll/assets/proxies/magick.rb
|
215
194
|
- lib/jekyll/assets/version.rb
|
216
195
|
homepage: http://github.com/jekyll/jekyll-assets/
|
data/lib/jekyll/assets/addons.rb
DELETED
data/lib/jekyll/assets/hooks.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# ----------------------------------------------------------------------------
|
2
|
-
# Frozen-string-literal: true
|
3
|
-
# Copyright: 2012 - 2016 - MIT License
|
4
|
-
# Encoding: utf-8
|
5
|
-
# ----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require_relative "hooks/jekyll/drops"
|
8
|
-
require_relative "hooks/jekyll/setup"
|
9
|
-
require_relative "hooks/jekyll/write"
|
10
|
-
require_relative "hooks/compression"
|
11
|
-
require_relative "hooks/config"
|
12
|
-
require_relative "hooks/helpers"
|
13
|
-
require_relative "hooks/logger"
|
14
|
-
require_relative "hooks/sources"
|
15
|
-
require_relative "hooks/sprockets"
|
16
|
-
require_relative "hooks/version"
|
17
|
-
require_relative "hooks/cache"
|
18
|
-
require_relative "hooks/erb"
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# ----------------------------------------------------------------------------
|
2
|
-
# Frozen-string-literal: true
|
3
|
-
# Copyright: 2012 - 2016 - MIT License
|
4
|
-
# Encoding: utf-8
|
5
|
-
# ----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
Jekyll::Assets::Hook.register :env, :init do
|
8
|
-
Sprockets::Helpers.configure do |config|
|
9
|
-
config.manifest = manifest
|
10
|
-
config.prefix = prefix_path
|
11
|
-
config.digest = digest?
|
12
|
-
end
|
13
|
-
end
|
data/lib/jekyll/assets/liquid.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# ----------------------------------------------------------------------------
|
2
|
-
# Frozen-string-literal: true
|
3
|
-
# Copyright: 2012 - 2016 - MIT License
|
4
|
-
# Encoding: utf-8
|
5
|
-
# ----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
module Jekyll
|
8
|
-
module Assets
|
9
|
-
module Liquid
|
10
|
-
require_relative "liquid/drop"
|
11
|
-
require_relative "liquid/filters"
|
12
|
-
require_relative "liquid/tag"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# ----------------------------------------------------------------------------
|
2
|
-
# Frozen-string-literal: true
|
3
|
-
# Copyright: 2012 - 2016 - MIT License
|
4
|
-
# Encoding: utf-8
|
5
|
-
# ----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require_relative "patches/sprockets/asset"
|
8
|
-
require_relative "patches/sprockets/helpers"
|
9
|
-
require_relative "patches/jekyll/site"
|
10
|
-
require_relative "patches/kernel"
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# ----------------------------------------------------------------------------
|
2
|
-
# Frozen-string-literal: true
|
3
|
-
# Copyright: 2012 - 2016 - MIT License
|
4
|
-
# Encoding: utf-8
|
5
|
-
# ----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "sprockets/helpers"
|
8
|
-
Sprockets::Helpers.instance_methods.reject { |v| v=~ /^(path_to_|assets_environment$)/ }.each do |m|
|
9
|
-
Sprockets::Helpers.send(:define_method, m.to_s.gsub(/_path$/, "_url")) do |*args|
|
10
|
-
%Q(url("#{send(m, *args)}"))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
module Sprockets
|
15
|
-
module Helpers
|
16
|
-
alias_method :_old_ap, :asset_path
|
17
|
-
|
18
|
-
def rcache
|
19
|
-
return @resolver_cache ||= {
|
20
|
-
#
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
def asset_path(asset, h = {})
|
25
|
-
return unless out = _old_ap(asset)
|
26
|
-
path = environment.find_asset(resolve_without_compat(asset))
|
27
|
-
environment.parent.used.add(path)
|
28
|
-
out
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require_relative "processors/liquid"
|
@@ -1 +0,0 @@
|
|
1
|
-
require_relative "proxies/magick"
|