jekyll-assets 3.0.8 → 3.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -33
- data/README.md +46 -35
- data/lib/jekyll/assets/compressors/uglify.rb +5 -3
- data/lib/jekyll/assets/drop.rb +4 -4
- data/lib/jekyll/assets/env.rb +16 -0
- data/lib/jekyll/assets/html.rb +1 -1
- data/lib/jekyll/assets/plugins/html/defaults/img.rb +16 -0
- data/lib/jekyll/assets/plugins/html/defaults/js.rb +7 -1
- data/lib/jekyll/assets/plugins/html/img.rb +17 -16
- data/lib/jekyll/assets/plugins/proxy/magick.rb +21 -23
- data/lib/jekyll/assets/plugins/proxy/optim.rb +18 -18
- data/lib/jekyll/assets/proxy.rb +25 -15
- data/lib/jekyll/assets/tag.rb +5 -3
- data/lib/jekyll/assets/utils.rb +11 -9
- data/lib/jekyll/assets/version.rb +1 -1
- metadata +227 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69490cec3f26e914aaf06d20fbaeacc6ccbc34ce69aee4e2f92c3e856f623ee8
|
4
|
+
data.tar.gz: c833a6459228b7b97715d65600caf4aefb646794db9830fe5d965288a2f1d93d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26753194cf22c65e2af6128c1efb33578fc509b81ac0c0febe86c5dffa0158db6a02f5ab3f35a0f0f4ac40a2b34189a452e19048898e706ddb7765ad53856294
|
7
|
+
data.tar.gz: 715aa0cf6fad406616b8a45e9946e2428f7ffeb6328685a843d9a7511721aac6c7b2763da075308d1d409ea0f076b858eb967fb0c0420078ae5ab5a5b3132d88
|
data/Gemfile
CHANGED
@@ -7,37 +7,8 @@ gemspec
|
|
7
7
|
|
8
8
|
sv = "~> 4.0.beta"
|
9
9
|
gem "sprockets", ENV["SPROCKETS_VERSION"] || sv, require: false
|
10
|
-
|
11
|
-
gem "
|
12
|
-
|
13
|
-
|
14
|
-
group :development do
|
15
|
-
gem "travis", require: false
|
16
|
-
gem "mini_racer", require: false if RUBY_PLATFORM != "java"
|
17
|
-
gem "therubyrhino", require: false if RUBY_PLATFORM == "java"
|
18
|
-
gem "pry", require: false
|
19
|
-
|
20
|
-
group :test do
|
21
|
-
gem "simplecov", require: false
|
22
|
-
gem "luna-rspec-formatters", require: false
|
23
|
-
gem "rubocop", "0.52", require: false
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# --
|
28
|
-
# Anything within this group is considered optional.
|
29
|
-
# You don't need it to run Jekyll-Assets, but they may
|
30
|
-
# provide more features for you to use.
|
31
|
-
# --
|
32
|
-
group :optionals do
|
33
|
-
gem "uglifier", require: false
|
34
|
-
gem "autoprefixer-rails", require: false
|
35
|
-
gem "font-awesome-sass", "~> 4.4", require: false
|
36
|
-
gem "image_optim_pack", "~> 0.5", require: false
|
37
|
-
gem "image_optim", "~> 0.25", require: false
|
38
|
-
gem "mini_magick", "~> 4.2", require: false
|
39
|
-
gem "babel-transpiler", require: false
|
40
|
-
gem "bootstrap", require: false
|
41
|
-
gem "sassc", require: false
|
42
|
-
gem "crass", require: false
|
10
|
+
if ENV["JEKYLL_VERSION"]
|
11
|
+
gem "jekyll", ENV["JEKYLL_VERSION"], {
|
12
|
+
require: false,
|
13
|
+
}
|
43
14
|
end
|
data/README.md
CHANGED
@@ -156,17 +156,17 @@ Jekyll Assets has the concept of responsive images, using the `picture` (when us
|
|
156
156
|
|
157
157
|
```liquid
|
158
158
|
{% asset img.png @pic
|
159
|
-
srcset:max-width="
|
160
|
-
srcset:max-width="
|
161
|
-
srcset:max-width="
|
159
|
+
srcset:max-width="200 2x"
|
160
|
+
srcset:max-width="150 1.5x"
|
161
|
+
srcset:max-width="100 1x"
|
162
162
|
%}
|
163
163
|
```
|
164
164
|
|
165
165
|
```html
|
166
166
|
<picture>
|
167
|
-
<source srcset="1.png 2x" media="(max-width:
|
168
|
-
<source srcset="2.png 1.5x" media="(max-width:
|
169
|
-
<source srcset="3.png 1x" media="(max-width:
|
167
|
+
<source srcset="1.png 2x" media="(max-width:200px)">
|
168
|
+
<source srcset="2.png 1.5x" media="(max-width:150px)">
|
169
|
+
<source srcset="3.png 1x" media="(max-width:100px)">
|
170
170
|
<img src="img.png">
|
171
171
|
</picture>
|
172
172
|
```
|
@@ -176,32 +176,45 @@ Jekyll Assets has the concept of responsive images, using the `picture` (when us
|
|
176
176
|
|
177
177
|
```liquid
|
178
178
|
{% asset img.png
|
179
|
-
srcset:width="
|
180
|
-
srcset:width="
|
181
|
-
srcset:width="
|
179
|
+
srcset:width="200 2x"
|
180
|
+
srcset:width="150 1.5x"
|
181
|
+
srcset:width="100 1x"
|
182
|
+
%}
|
183
|
+
|
184
|
+
{% asset img.svg
|
185
|
+
srcset:width="200 2x jpg"
|
186
|
+
srcset:width="150 1.5x jpg"
|
187
|
+
srcset:width="100 1x jpg"
|
182
188
|
%}
|
183
189
|
|
184
190
|
{% asset img.png
|
185
|
-
srcset:width=
|
186
|
-
srcset:width=
|
187
|
-
srcset:width=
|
191
|
+
srcset:width=200
|
192
|
+
srcset:width=150
|
193
|
+
srcset:width=200
|
188
194
|
%}
|
189
195
|
```
|
190
196
|
|
191
197
|
```html
|
192
|
-
<img srcset="1.png
|
193
|
-
<img srcset="1.
|
198
|
+
<img srcset="1.png 2x, 2.png 1.5x, 3.png 1x">
|
199
|
+
<img srcset="1.jpg 2x, 2.jpg 1.5x, 3.jpg 1x">
|
200
|
+
<img srcset="1.png 200w, 2.png 150w, 3.pnx 200w">
|
194
201
|
```
|
195
202
|
|
196
|
-
##### Args
|
203
|
+
##### Args for `<img srcset>`
|
204
|
+
|
205
|
+
| Arg | Type | Description |
|
206
|
+
| ----------- | --------------------- | ------------------------------------------------ |
|
207
|
+
| `width` | Width [Density, Type] | Resize, set `srcset="<Src> <<Width>px/Density>"` |
|
197
208
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
|
202
|
-
|
|
203
|
-
| `
|
204
|
-
| `
|
209
|
+
|
210
|
+
##### Args for `@pic`
|
211
|
+
|
212
|
+
| Arg | Type | Description |
|
213
|
+
| ----------- | --------------- | -------------------------------------------- |
|
214
|
+
| `min-width` | Width [Density] | Resize, set `media="(min-width: <Width>px)"` |
|
215
|
+
| `max-width` | Width [Density] | Resize, set `media="(max-width: <Width>px)"` |
|
216
|
+
| `sizes` | Any | Your value, unaltered, unparsed. |
|
217
|
+
| `media` | Any | Your value, unaltered, unparsed. |
|
205
218
|
|
206
219
|
*If you set `media`, w/ `max-width`, `min-width`, we will not ship `media`, we will simply resize and assume you know what you're doing. Our parser is not complex, and does not make a whole lot of assumptions on your behalf, it's simple and only meant to make your life easier. In the future we may make it more advanced.*
|
207
220
|
|
@@ -306,7 +319,7 @@ Using Liquid Drop `assets`, you can check whether an asset is present.
|
|
306
319
|
## Filter
|
307
320
|
|
308
321
|
```liquid
|
309
|
-
{{ src | asset:"@magick:2x magick:quality
|
322
|
+
{{ src | asset:"@magick:2x magick:quality=92" }}
|
310
323
|
```
|
311
324
|
|
312
325
|
## Polymer WebComponents
|
@@ -478,6 +491,8 @@ to get an idea what `<value>` can be.
|
|
478
491
|
| `magick:gravity` | ✔ |
|
479
492
|
| `magick:crop` | ✔ |
|
480
493
|
| `magick:flip` | ✔ |
|
494
|
+
| `magick:background` | ✔ |
|
495
|
+
| `magick:transparency` | ✔ |
|
481
496
|
| `@magick:double` | ✗ |
|
482
497
|
| `@magick:half` | ✗ |
|
483
498
|
|
@@ -487,33 +502,29 @@ to get an idea what `<value>` can be.
|
|
487
502
|
|
488
503
|
```ruby
|
489
504
|
gem "image_optim"
|
505
|
+
gem "image_optim_bin" # Optional
|
490
506
|
```
|
491
507
|
|
492
|
-
|
508
|
+
#### Configuration
|
493
509
|
|
494
510
|
```yml
|
495
511
|
assets:
|
496
512
|
plugins:
|
497
513
|
img:
|
498
514
|
optim:
|
499
|
-
|
500
|
-
verbose: true
|
501
|
-
zero_png:
|
502
|
-
advpng:
|
503
|
-
level: 0
|
504
|
-
optipng:
|
505
|
-
level: 0
|
506
|
-
pngout:
|
507
|
-
strategy: 4
|
515
|
+
{}
|
508
516
|
```
|
509
517
|
|
518
|
+
Check the [ImageOptim](https://github.com/toy/image_optim#configuration) to get idea about configuration options, and to get a list of stuff you need to install on your system to use it, if you do not wish to use "image_optim_bin",
|
519
|
+
|
510
520
|
#### Args
|
511
521
|
|
512
522
|
| Name | Accepts Value |
|
513
523
|
| --------------------------------- | ------------- |
|
514
|
-
|
|
524
|
+
| `optim` | ✔ |
|
525
|
+
| `@optim` | ✗ |
|
515
526
|
|
516
|
-
|
527
|
+
***By default `@optim` will use the default `jekyll`, otherwise you can provide `optim=preset` and have it used that preset. ImageOptim provides advanced, and default as their default presets, you can define your own preset via Jekyll Assets configuration listed above.***
|
517
528
|
|
518
529
|
### Building Your Own Plugins
|
519
530
|
#### Globals
|
@@ -19,10 +19,12 @@ module Jekyll
|
|
19
19
|
# rubocop:disable Metrics/LineLength
|
20
20
|
Sprockets.register_compressor "application/javascript", :assets_uglify, Uglify
|
21
21
|
Hook.register :env, :after_init, priority: 3 do |e|
|
22
|
+
enable = e.asset_config[:compression]
|
23
|
+
config = e.asset_config[:compressors][:uglifier].symbolize_keys
|
22
24
|
e.js_compressor = nil
|
23
|
-
|
24
|
-
if Utils.javascript?
|
25
|
-
e.js_compressor =
|
25
|
+
|
26
|
+
if enable && Utils.javascript? && Utils.activate("uglifier")
|
27
|
+
e.js_compressor = Uglify.new(config)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
data/lib/jekyll/assets/drop.rb
CHANGED
@@ -43,12 +43,12 @@ module Jekyll
|
|
43
43
|
img = FastImage.size(asset.filename.to_s)
|
44
44
|
|
45
45
|
{
|
46
|
-
width
|
47
|
-
height
|
46
|
+
"width" => img[0],
|
47
|
+
"height" => img[1],
|
48
48
|
}
|
49
|
+
rescue => e
|
50
|
+
Logger.error e
|
49
51
|
end
|
50
|
-
rescue => e
|
51
|
-
Logger.error e
|
52
52
|
end
|
53
53
|
|
54
54
|
private
|
data/lib/jekyll/assets/env.rb
CHANGED
@@ -52,6 +52,7 @@ module Jekyll
|
|
52
52
|
@cache = nil
|
53
53
|
|
54
54
|
setup_sources!
|
55
|
+
setup_resolver!
|
55
56
|
ignore_caches!
|
56
57
|
setup_drops!
|
57
58
|
precompile!
|
@@ -180,6 +181,21 @@ module Jekyll
|
|
180
181
|
nil
|
181
182
|
end
|
182
183
|
|
184
|
+
# --
|
185
|
+
private
|
186
|
+
def setup_resolver!
|
187
|
+
create_resolver!
|
188
|
+
depend_on "jekyll-env"
|
189
|
+
end
|
190
|
+
|
191
|
+
# --
|
192
|
+
private
|
193
|
+
def create_resolver!
|
194
|
+
register_dependency_resolver "jekyll-env" do
|
195
|
+
ENV["JEKYLL_ENV"]
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
183
199
|
# --
|
184
200
|
private
|
185
201
|
def setup_sources!
|
data/lib/jekyll/assets/html.rb
CHANGED
@@ -11,6 +11,20 @@ module Jekyll
|
|
11
11
|
content_types %r!^image/(?\!x-icon$)[a-zA-Z0-9\-_\+]+$!
|
12
12
|
internal!
|
13
13
|
|
14
|
+
# --
|
15
|
+
def set_width
|
16
|
+
unless args.key?(:width) || !config[:width]
|
17
|
+
args[:width] = "100%"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# --
|
22
|
+
def set_height
|
23
|
+
unless args.key?(:height) || !config[:height]
|
24
|
+
args[:height] = "auto"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
14
28
|
# --
|
15
29
|
def set_src
|
16
30
|
dpath = @asset.digest_path
|
@@ -43,7 +57,9 @@ Jekyll::Assets::Hook.register :config, :before_merge do |c|
|
|
43
57
|
c.deep_merge!({
|
44
58
|
defaults: {
|
45
59
|
img: {
|
60
|
+
height: false,
|
46
61
|
integrity: Jekyll.production?,
|
62
|
+
width: false,
|
47
63
|
},
|
48
64
|
},
|
49
65
|
})
|
@@ -8,10 +8,15 @@ module Jekyll
|
|
8
8
|
module Assets
|
9
9
|
class Default
|
10
10
|
class JS < Default
|
11
|
-
static type: "text/javascript"
|
12
11
|
content_types "application/javascript"
|
13
12
|
internal!
|
14
13
|
|
14
|
+
# --
|
15
|
+
def set_type
|
16
|
+
return if @args.key?(:type) || !config[:type]
|
17
|
+
@args[:type] = "text/javascript"
|
18
|
+
end
|
19
|
+
|
15
20
|
# --
|
16
21
|
def set_src
|
17
22
|
return if @args[:inline]
|
@@ -45,6 +50,7 @@ Jekyll::Assets::Hook.register :config, :before_merge do |c|
|
|
45
50
|
defaults: {
|
46
51
|
js: {
|
47
52
|
integrity: Jekyll.production?,
|
53
|
+
type: true,
|
48
54
|
},
|
49
55
|
},
|
50
56
|
})
|
@@ -14,13 +14,9 @@ module Jekyll
|
|
14
14
|
# --
|
15
15
|
def run
|
16
16
|
Nokogiri::HTML::Builder.with(doc) do |d|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
d.img(args.to_h({
|
21
|
-
html: true, skip: HTML.skips
|
22
|
-
}))
|
23
|
-
end
|
17
|
+
srcset? ? complex(d) : d.img(args.to_h({
|
18
|
+
html: true, skip: HTML.skips
|
19
|
+
}))
|
24
20
|
end
|
25
21
|
end
|
26
22
|
|
@@ -28,21 +24,26 @@ module Jekyll
|
|
28
24
|
def complex(doc)
|
29
25
|
img = doc.img @args.to_h(html: true, skip: HTML.skips)
|
30
26
|
Array(args[:srcset][:width]).each do |w|
|
31
|
-
|
32
|
-
Integer(w)
|
27
|
+
dimensions, density, type = w.to_s.split(%r!\s+!, 3)
|
33
28
|
|
34
29
|
img["srcset"] ||= ""
|
35
|
-
img["srcset"] += ", #{path(
|
36
|
-
img["srcset"]
|
37
|
-
|
30
|
+
img["srcset"] += ", #{path(dimensions: dimensions, type: type)} "
|
31
|
+
img["srcset"] += density || "#{dimensions}w"
|
32
|
+
img["srcset"] = img["srcset"]
|
33
|
+
.gsub(%r!^,\s*!, "")
|
38
34
|
end
|
39
35
|
end
|
40
36
|
|
41
37
|
# --
|
42
|
-
def path(
|
43
|
-
args_ =
|
44
|
-
|
45
|
-
|
38
|
+
def path(dimensions:, type: nil)
|
39
|
+
args_ = "#{args[:argv1]} @path"
|
40
|
+
args_ += " magick:resize=#{dimensions}"
|
41
|
+
args_ += " magick:format=#{type}" if type
|
42
|
+
args_ += " @optim" if args.key?(:optim)
|
43
|
+
|
44
|
+
pctx = Liquid::ParseContext.new
|
45
|
+
tag = Tag.new("asset", args_, pctx)
|
46
|
+
tag.render(ctx)
|
46
47
|
end
|
47
48
|
|
48
49
|
# --
|
@@ -8,14 +8,8 @@ module Jekyll
|
|
8
8
|
module Assets
|
9
9
|
module Plugins
|
10
10
|
class MiniMagick < Proxy
|
11
|
+
content_types %r!^image/(?\!x-icon$)[a-zA-Z0-9\-_\+]+$!
|
11
12
|
arg_keys :magick
|
12
|
-
content_types "image/webp"
|
13
|
-
content_types "image/jpeg"
|
14
|
-
content_types "image/svg+xml"
|
15
|
-
content_types "image/tiff"
|
16
|
-
content_types "image/bmp"
|
17
|
-
content_types "image/gif"
|
18
|
-
content_types "image/png"
|
19
13
|
|
20
14
|
class SameType < StandardError
|
21
15
|
def initialize(type)
|
@@ -24,19 +18,18 @@ module Jekyll
|
|
24
18
|
end
|
25
19
|
|
26
20
|
def process
|
27
|
-
img = ::MiniMagick::Image.
|
21
|
+
img = ::MiniMagick::Image.new(@file)
|
28
22
|
magick_format(img) if @args[:magick][:format]
|
29
23
|
img.combine_options do |c|
|
30
24
|
@args[:magick].keys.reject { |k| k == :format }.each do |k|
|
31
25
|
m = "magick_#{k}"
|
32
26
|
|
33
|
-
if
|
27
|
+
if respond_to?(m, true)
|
34
28
|
method(m).arity == 2 ? send(m, img, c) : send(m, c)
|
35
29
|
end
|
36
30
|
end
|
37
31
|
end
|
38
32
|
|
39
|
-
img.write(@file)
|
40
33
|
@file
|
41
34
|
ensure
|
42
35
|
img&.destroy!
|
@@ -50,22 +43,27 @@ module Jekyll
|
|
50
43
|
|
51
44
|
private
|
52
45
|
def magick_format(img)
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
format = ".#{@args[:magick][:format].sub(%r!^\.!, '')}"
|
47
|
+
ext = @env.mime_exts.find { |k, v| k == format || v == format }
|
48
|
+
return unless ext
|
49
|
+
|
50
|
+
ext, type = ext
|
51
|
+
raise SameType, type if type == asset.content_type
|
52
|
+
img.format(ext.sub(".", ""))
|
53
|
+
end
|
56
54
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
img.format(ext.sub(".", ""))
|
62
|
-
@file.cp(new_)
|
63
|
-
@file.rm
|
64
|
-
@file =
|
65
|
-
new_
|
55
|
+
private
|
56
|
+
def magick_transparency(cmd)
|
57
|
+
if @args[:magick][:transparency]
|
58
|
+
cmd.transparency @args[:magick][:transparency]
|
66
59
|
end
|
60
|
+
end
|
67
61
|
|
68
|
-
|
62
|
+
private
|
63
|
+
def magick_background(cmd)
|
64
|
+
if @args[:magick].key?(:background)
|
65
|
+
cmd.background @args[:magick][:background]
|
66
|
+
end
|
69
67
|
end
|
70
68
|
|
71
69
|
private
|
@@ -8,14 +8,8 @@ module Jekyll
|
|
8
8
|
module Assets
|
9
9
|
module Plugins
|
10
10
|
class ImageOptim < Proxy
|
11
|
+
content_types %r!^image/(?\!x-icon$)[a-zA-Z0-9\-_\+]+$!
|
11
12
|
arg_keys :optim
|
12
|
-
content_types "image/webp"
|
13
|
-
content_types "image/jpeg"
|
14
|
-
content_types "image/svg+xml"
|
15
|
-
content_types "image/tiff"
|
16
|
-
content_types "image/bmp"
|
17
|
-
content_types "image/gif"
|
18
|
-
content_types "image/png"
|
19
13
|
|
20
14
|
class UnknownPresetError < RuntimeError
|
21
15
|
def initialize(name)
|
@@ -31,17 +25,11 @@ module Jekyll
|
|
31
25
|
end
|
32
26
|
|
33
27
|
def process
|
34
|
-
optimc = @env.asset_config[:plugins][:img][:optim]
|
35
|
-
preset = @args[:optim].keys
|
36
|
-
if preset.count > 1
|
37
|
-
raise MultiplePredefinedPresetsSpecified
|
38
|
-
end
|
39
|
-
|
40
|
-
preset = preset.first
|
41
28
|
# rubocop:disable Metrics/LineLength
|
42
|
-
|
43
|
-
|
44
|
-
|
29
|
+
optimc = @env.asset_config[:plugins][:img][:optim]
|
30
|
+
preset = @args[:optim] == true ? :jekyll : @args[:optim].to_sym
|
31
|
+
raise UnknownPreset, preset if preset != :jekyll && !optimc.key?(preset)
|
32
|
+
optim = ::ImageOptim.new(optimc[preset] || {})
|
45
33
|
optim.optimize_image!(@file)
|
46
34
|
@file
|
47
35
|
end
|
@@ -56,7 +44,19 @@ Jekyll::Assets::Hook.register :config, :before_merge do |c|
|
|
56
44
|
plugins: {
|
57
45
|
img: {
|
58
46
|
optim: {
|
59
|
-
|
47
|
+
jekyll: {
|
48
|
+
pngout: false,
|
49
|
+
allow_lossy: true,
|
50
|
+
jpegtran: { progressive: false },
|
51
|
+
jpegrecompress: { quality: 2 },
|
52
|
+
advpng: false,
|
53
|
+
svgo: false,
|
54
|
+
jpegoptim: {
|
55
|
+
max_quality: 60,
|
56
|
+
allow_lossy: true,
|
57
|
+
strip: :all,
|
58
|
+
},
|
59
|
+
},
|
60
60
|
},
|
61
61
|
},
|
62
62
|
},
|
data/lib/jekyll/assets/proxy.rb
CHANGED
@@ -28,16 +28,12 @@ module Jekyll
|
|
28
28
|
# @return [Sprockets::Asset]
|
29
29
|
# --
|
30
30
|
def self.proxy(asset, args:, ctx:)
|
31
|
-
proxies = Proxy.inherited.select do |o|
|
32
|
-
o.for?(type: asset.content_type, args: args)
|
33
|
-
end
|
34
|
-
|
35
|
-
return asset if proxies.empty?
|
36
31
|
env = ctx.registers[:site].sprockets
|
37
|
-
|
38
|
-
|
32
|
+
return asset if (proxies = proxies_for(asset: asset, args: args)).empty?
|
33
|
+
key = digest(args)
|
39
34
|
|
40
|
-
env.cache.fetch(
|
35
|
+
out = env.cache.fetch(key) do
|
36
|
+
file = copy(asset, args: args, ctx: ctx)
|
41
37
|
proxies.each do |o|
|
42
38
|
obj = o.new(file, {
|
43
39
|
args: args,
|
@@ -50,10 +46,20 @@ module Jekyll
|
|
50
46
|
raise Deleted, o unless file.exist?
|
51
47
|
end
|
52
48
|
|
53
|
-
|
49
|
+
file
|
54
50
|
end
|
55
51
|
|
56
|
-
env.find_asset!(
|
52
|
+
env.find_asset!(out)
|
53
|
+
end
|
54
|
+
|
55
|
+
# --
|
56
|
+
def self.proxies_for(asset:, args:)
|
57
|
+
Proxy.inherited.select do |o|
|
58
|
+
o.for?({
|
59
|
+
type: asset.content_type,
|
60
|
+
args: args,
|
61
|
+
})
|
62
|
+
end
|
57
63
|
end
|
58
64
|
|
59
65
|
# --
|
@@ -92,12 +98,16 @@ module Jekyll
|
|
92
98
|
# @param [Symbol] key the key.
|
93
99
|
# --
|
94
100
|
def self.args_key(key = nil)
|
95
|
-
|
96
|
-
|
97
|
-
key
|
98
|
-
end
|
101
|
+
key.nil? ? @key : @key = key
|
102
|
+
end
|
99
103
|
|
100
|
-
|
104
|
+
# --
|
105
|
+
# Return a list of proxy keys.
|
106
|
+
# This allows you to select their values from args.
|
107
|
+
# @return [Array<Symbol>]
|
108
|
+
# --
|
109
|
+
def self.keys
|
110
|
+
inherited.map(&:arg_keys).flatten
|
101
111
|
end
|
102
112
|
|
103
113
|
# --
|
data/lib/jekyll/assets/tag.rb
CHANGED
@@ -183,8 +183,10 @@ module Jekyll
|
|
183
183
|
# --
|
184
184
|
def e_not_found(e, ctx:)
|
185
185
|
lines = e.message.each_line.to_a
|
186
|
-
page
|
187
|
-
|
186
|
+
page = ctx.registers[:page]&.[]("relative_path")
|
187
|
+
page ||= ctx.registers[:page]&.[]("path")
|
188
|
+
|
189
|
+
lines[0] = lines[0].strip + " in `#{page || 'Untraceable'}'\n\n"
|
188
190
|
raise e.class, lines.join
|
189
191
|
end
|
190
192
|
|
@@ -194,7 +196,7 @@ module Jekyll
|
|
194
196
|
env = ctx.registers[:site].sprockets
|
195
197
|
|
196
198
|
env.logger.error e.message
|
197
|
-
env.logger.
|
199
|
+
env.logger.err_file args[:argv1]
|
198
200
|
raise e.class, "JS Error"
|
199
201
|
end
|
200
202
|
|
data/lib/jekyll/assets/utils.rb
CHANGED
@@ -71,17 +71,19 @@ module Jekyll
|
|
71
71
|
}
|
72
72
|
end
|
73
73
|
else
|
74
|
-
|
74
|
+
glob_paths(v).each do |p|
|
75
|
+
next unless p
|
75
76
|
|
76
|
-
|
77
|
-
|
78
|
-
|
77
|
+
dst = strip_paths(p)
|
78
|
+
dst = in_dest_dir(dst)
|
79
|
+
dst.parent.mkdir_p
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
a << {
|
82
|
+
src: path,
|
83
|
+
full_dst: dst,
|
84
|
+
dst: dst,
|
85
|
+
}
|
86
|
+
end
|
85
87
|
end
|
86
88
|
end
|
87
89
|
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: 3.0.
|
4
|
+
version: 3.0.9
|
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: 2018-
|
13
|
+
date: 2018-04-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: execjs
|
@@ -184,6 +184,230 @@ dependencies:
|
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '3.4'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: sassc
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - "~>"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '1.11'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - "~>"
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '1.11'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: uglifier
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - "~>"
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '4.1'
|
208
|
+
type: :development
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - "~>"
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '4.1'
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: mini_racer
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - "~>"
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0.1'
|
222
|
+
type: :development
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - "~>"
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0.1'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: image_optim
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - "~>"
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0.25'
|
236
|
+
type: :development
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - "~>"
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0.25'
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: image_optim_pack
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - "~>"
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '0.5'
|
250
|
+
type: :development
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - "~>"
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: '0.5'
|
257
|
+
- !ruby/object:Gem::Dependency
|
258
|
+
name: font-awesome-sass
|
259
|
+
requirement: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - "~>"
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: '5.0'
|
264
|
+
type: :development
|
265
|
+
prerelease: false
|
266
|
+
version_requirements: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - "~>"
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: '5.0'
|
271
|
+
- !ruby/object:Gem::Dependency
|
272
|
+
name: luna-rspec-formatters
|
273
|
+
requirement: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - "~>"
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '3'
|
278
|
+
type: :development
|
279
|
+
prerelease: false
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
281
|
+
requirements:
|
282
|
+
- - "~>"
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: '3'
|
285
|
+
- !ruby/object:Gem::Dependency
|
286
|
+
name: autoprefixer-rails
|
287
|
+
requirement: !ruby/object:Gem::Requirement
|
288
|
+
requirements:
|
289
|
+
- - "~>"
|
290
|
+
- !ruby/object:Gem::Version
|
291
|
+
version: '8.2'
|
292
|
+
type: :development
|
293
|
+
prerelease: false
|
294
|
+
version_requirements: !ruby/object:Gem::Requirement
|
295
|
+
requirements:
|
296
|
+
- - "~>"
|
297
|
+
- !ruby/object:Gem::Version
|
298
|
+
version: '8.2'
|
299
|
+
- !ruby/object:Gem::Dependency
|
300
|
+
name: babel-transpiler
|
301
|
+
requirement: !ruby/object:Gem::Requirement
|
302
|
+
requirements:
|
303
|
+
- - "~>"
|
304
|
+
- !ruby/object:Gem::Version
|
305
|
+
version: '0.7'
|
306
|
+
type: :development
|
307
|
+
prerelease: false
|
308
|
+
version_requirements: !ruby/object:Gem::Requirement
|
309
|
+
requirements:
|
310
|
+
- - "~>"
|
311
|
+
- !ruby/object:Gem::Version
|
312
|
+
version: '0.7'
|
313
|
+
- !ruby/object:Gem::Dependency
|
314
|
+
name: mini_magick
|
315
|
+
requirement: !ruby/object:Gem::Requirement
|
316
|
+
requirements:
|
317
|
+
- - "~>"
|
318
|
+
- !ruby/object:Gem::Version
|
319
|
+
version: '4.2'
|
320
|
+
type: :development
|
321
|
+
prerelease: false
|
322
|
+
version_requirements: !ruby/object:Gem::Requirement
|
323
|
+
requirements:
|
324
|
+
- - "~>"
|
325
|
+
- !ruby/object:Gem::Version
|
326
|
+
version: '4.2'
|
327
|
+
- !ruby/object:Gem::Dependency
|
328
|
+
name: simplecov
|
329
|
+
requirement: !ruby/object:Gem::Requirement
|
330
|
+
requirements:
|
331
|
+
- - "~>"
|
332
|
+
- !ruby/object:Gem::Version
|
333
|
+
version: '0.16'
|
334
|
+
type: :development
|
335
|
+
prerelease: false
|
336
|
+
version_requirements: !ruby/object:Gem::Requirement
|
337
|
+
requirements:
|
338
|
+
- - "~>"
|
339
|
+
- !ruby/object:Gem::Version
|
340
|
+
version: '0.16'
|
341
|
+
- !ruby/object:Gem::Dependency
|
342
|
+
name: bootstrap
|
343
|
+
requirement: !ruby/object:Gem::Requirement
|
344
|
+
requirements:
|
345
|
+
- - "~>"
|
346
|
+
- !ruby/object:Gem::Version
|
347
|
+
version: '4.0'
|
348
|
+
type: :development
|
349
|
+
prerelease: false
|
350
|
+
version_requirements: !ruby/object:Gem::Requirement
|
351
|
+
requirements:
|
352
|
+
- - "~>"
|
353
|
+
- !ruby/object:Gem::Version
|
354
|
+
version: '4.0'
|
355
|
+
- !ruby/object:Gem::Dependency
|
356
|
+
name: crass
|
357
|
+
requirement: !ruby/object:Gem::Requirement
|
358
|
+
requirements:
|
359
|
+
- - "~>"
|
360
|
+
- !ruby/object:Gem::Version
|
361
|
+
version: '1.0'
|
362
|
+
type: :development
|
363
|
+
prerelease: false
|
364
|
+
version_requirements: !ruby/object:Gem::Requirement
|
365
|
+
requirements:
|
366
|
+
- - "~>"
|
367
|
+
- !ruby/object:Gem::Version
|
368
|
+
version: '1.0'
|
369
|
+
- !ruby/object:Gem::Dependency
|
370
|
+
name: rubocop
|
371
|
+
requirement: !ruby/object:Gem::Requirement
|
372
|
+
requirements:
|
373
|
+
- - '='
|
374
|
+
- !ruby/object:Gem::Version
|
375
|
+
version: '0.52'
|
376
|
+
type: :development
|
377
|
+
prerelease: false
|
378
|
+
version_requirements: !ruby/object:Gem::Requirement
|
379
|
+
requirements:
|
380
|
+
- - '='
|
381
|
+
- !ruby/object:Gem::Version
|
382
|
+
version: '0.52'
|
383
|
+
- !ruby/object:Gem::Dependency
|
384
|
+
name: rake
|
385
|
+
requirement: !ruby/object:Gem::Requirement
|
386
|
+
requirements:
|
387
|
+
- - "~>"
|
388
|
+
- !ruby/object:Gem::Version
|
389
|
+
version: '12'
|
390
|
+
type: :development
|
391
|
+
prerelease: false
|
392
|
+
version_requirements: !ruby/object:Gem::Requirement
|
393
|
+
requirements:
|
394
|
+
- - "~>"
|
395
|
+
- !ruby/object:Gem::Version
|
396
|
+
version: '12'
|
397
|
+
- !ruby/object:Gem::Dependency
|
398
|
+
name: pry
|
399
|
+
requirement: !ruby/object:Gem::Requirement
|
400
|
+
requirements:
|
401
|
+
- - "~>"
|
402
|
+
- !ruby/object:Gem::Version
|
403
|
+
version: '0'
|
404
|
+
type: :development
|
405
|
+
prerelease: false
|
406
|
+
version_requirements: !ruby/object:Gem::Requirement
|
407
|
+
requirements:
|
408
|
+
- - "~>"
|
409
|
+
- !ruby/object:Gem::Version
|
410
|
+
version: '0'
|
187
411
|
description: |
|
188
412
|
A drop-in Jekyll Plugin that provides an asset pipeline for JavaScript,
|
189
413
|
CSS, SASS, SCSS. Based around Sprockets (from Rails) and just as powereful
|
@@ -281,7 +505,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
505
|
version: '0'
|
282
506
|
requirements: []
|
283
507
|
rubyforge_project:
|
284
|
-
rubygems_version: 2.7.
|
508
|
+
rubygems_version: 2.7.6
|
285
509
|
signing_key:
|
286
510
|
specification_version: 4
|
287
511
|
summary: Assets for Jekyll
|