jekyll-assets 3.0.3 → 3.0.4
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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/Rakefile +4 -4
- data/lib/jekyll/assets.rb +3 -2
- data/lib/jekyll/assets/env.rb +16 -2
- data/lib/jekyll/assets/extensible.rb +0 -1
- data/lib/jekyll/assets/hook.rb +6 -0
- data/lib/jekyll/assets/plugins/html/audio.rb +2 -9
- data/lib/jekyll/assets/plugins/html/css.rb +1 -0
- data/lib/jekyll/assets/plugins/html/defaults/audio.rb +1 -9
- data/lib/jekyll/assets/plugins/html/defaults/component.rb +1 -0
- data/lib/jekyll/assets/plugins/html/defaults/css.rb +4 -2
- data/lib/jekyll/assets/plugins/html/defaults/img.rb +3 -8
- data/lib/jekyll/assets/plugins/html/defaults/js.rb +3 -1
- data/lib/jekyll/assets/plugins/html/defaults/vid.rb +1 -3
- data/lib/jekyll/assets/plugins/html/img.rb +1 -8
- data/lib/jekyll/assets/plugins/html/js.rb +2 -2
- data/lib/jekyll/assets/plugins/html/pic.rb +1 -8
- data/lib/jekyll/assets/plugins/html/vid.rb +2 -3
- data/lib/jekyll/assets/tag.rb +1 -1
- data/lib/jekyll/assets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 956874eaef40060f91ee70fa12d341165a14b586
|
4
|
+
data.tar.gz: 2798261d1cf3db699cfa830c77eb0f8d15acecc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 900c2f932b8abd7a5278ade5b7da07c38df283d45add5e8f17e4ba79b83200c861567ea6d2bd246ea2e0d96fc4ddecf7956efda2747ac7216a1b6cb965c1432a
|
7
|
+
data.tar.gz: 76db8348452356b0b275089da30d2ffa93cd5e2b24634a9ebcf5e42bb90867ef65247241fc3732dfb7efa6ed0f72564d70745ba97d5c29c09006264dc95a009f
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
[](https://codeclimate.com/github/envygeeks/jekyll-assets/maintainability)
|
2
2
|
[](https://codeclimate.com/github/envygeeks/jekyll-assets/test_coverage)
|
3
3
|
[](https://travis-ci.org/envygeeks/jekyll-assets)
|
4
|
-
[](https://
|
4
|
+
[](https://www.paypal.com/donate/?token=2YE-4wLE2dSgtPaQqTlQgcD2BvKv_tkHUD7GJYs4OskLI0l6XFEAKpNc5rIG6-bAeMFdom)
|
5
5
|

|
6
6
|

|
7
7
|
|
@@ -359,6 +359,7 @@ We have basic support for WebComponents when using Sprockets `~> 4.0.0.beta`, th
|
|
359
359
|
|---|---|---|---|
|
360
360
|
| `:env` | `:before_init` | ✔ | ✗ |
|
361
361
|
| `:env` | `:after_init` | ✔ | ✗ |
|
362
|
+
| `:env` | `:after_write` | ✔ | ✗ |
|
362
363
|
| `:config` | `:before_merge` | ✗ | `Config{}` |
|
363
364
|
| `asset` | `:before_compile` | ✗ | `Asset`, `Manifest` |
|
364
365
|
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright: 2012 - 2017 - MIT License
|
3
3
|
# Encoding: utf-8
|
4
4
|
|
5
|
-
task(:spec) {
|
6
|
-
task(:test) {
|
7
|
-
task(:rubocop) {
|
8
|
-
task(:lint) {
|
5
|
+
task(:spec) { exec "script/test" }
|
6
|
+
task(:test) { exec "script/test" }
|
7
|
+
task(:rubocop) { exec "script/lint" }
|
8
|
+
task(:lint) { exec "script/lint" }
|
data/lib/jekyll/assets.rb
CHANGED
@@ -18,6 +18,7 @@ def require_all(*globs)
|
|
18
18
|
end
|
19
19
|
|
20
20
|
require_relative "assets/env"
|
21
|
-
Jekyll::Hooks.register
|
22
|
-
|
21
|
+
Jekyll::Hooks.register(:site, :post_read) { |o| Jekyll::Assets::Env.new(o) }
|
22
|
+
Jekyll::Hooks.register :site, :post_write do |o|
|
23
|
+
o&.sprockets&.write_all
|
23
24
|
end
|
data/lib/jekyll/assets/env.rb
CHANGED
@@ -28,6 +28,7 @@ module Jekyll
|
|
28
28
|
|
29
29
|
# --
|
30
30
|
attr_reader :manifest
|
31
|
+
attr_accessor :assets_to_write
|
31
32
|
attr_reader :asset_config
|
32
33
|
attr_reader :jekyll
|
33
34
|
|
@@ -42,6 +43,7 @@ module Jekyll
|
|
42
43
|
|
43
44
|
super()
|
44
45
|
@jekyll = jekyll
|
46
|
+
@assets_to_write = []
|
45
47
|
@manifest = Manifest.new(self, in_dest_dir)
|
46
48
|
@jekyll.sprockets = self
|
47
49
|
@logger = Logger
|
@@ -116,6 +118,18 @@ module Jekyll
|
|
116
118
|
end
|
117
119
|
end
|
118
120
|
|
121
|
+
# --
|
122
|
+
def write_all
|
123
|
+
manifest.compile(*assets_to_write); @asset_to_write = []
|
124
|
+
Logger.debug "Calling hooks for env, after_write" do
|
125
|
+
Hook.trigger :env, :after_write do |h|
|
126
|
+
instance_eval(&h)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
true
|
131
|
+
end
|
132
|
+
|
119
133
|
# --
|
120
134
|
private
|
121
135
|
def ignore_caches!
|
@@ -147,8 +161,8 @@ module Jekyll
|
|
147
161
|
def precompile!
|
148
162
|
assets = asset_config[:precompile]
|
149
163
|
assets.map do |v|
|
150
|
-
v !~ %r!\*! ?
|
151
|
-
|
164
|
+
v !~ %r!\*! ? @assets_to_write |= [sv] : glob_paths(v).each do |sv|
|
165
|
+
@assets_to_write |= [sv]
|
152
166
|
end
|
153
167
|
end
|
154
168
|
|
data/lib/jekyll/assets/hook.rb
CHANGED
@@ -9,16 +9,9 @@ module Jekyll
|
|
9
9
|
module Assets
|
10
10
|
class HTML
|
11
11
|
class Audio < HTML
|
12
|
-
content_types
|
13
|
-
content_types "audio/basic"
|
14
|
-
content_types "audio/mpeg"
|
15
|
-
content_types "audio/midi"
|
16
|
-
content_types "audio/wave"
|
17
|
-
content_types "audio/mp4"
|
18
|
-
content_types "audio/ogg"
|
19
|
-
content_types "audio/flac"
|
20
|
-
content_types "audio/aac"
|
12
|
+
content_types %r!^audio/[a-zA-Z0-9\-_]+$!
|
21
13
|
|
14
|
+
# --
|
22
15
|
def run
|
23
16
|
Nokogiri::HTML::Builder.with(doc) do |d|
|
24
17
|
d.audio("No support for audio.", args.to_h({
|
@@ -8,15 +8,7 @@ module Jekyll
|
|
8
8
|
module Assets
|
9
9
|
class Default
|
10
10
|
class Audio < Default
|
11
|
-
content_types
|
12
|
-
content_types "audio/basic"
|
13
|
-
content_types "audio/mpeg"
|
14
|
-
content_types "audio/midi"
|
15
|
-
content_types "audio/wave"
|
16
|
-
content_types "audio/mp4"
|
17
|
-
content_types "audio/ogg"
|
18
|
-
content_types "audio/flac"
|
19
|
-
content_types "audio/aac"
|
11
|
+
content_types %r!^audio/[a-zA-Z0-9\-_]+$!
|
20
12
|
|
21
13
|
# --
|
22
14
|
def set_src
|
@@ -8,16 +8,18 @@ module Jekyll
|
|
8
8
|
module Assets
|
9
9
|
class Default
|
10
10
|
class CSS < Default
|
11
|
-
static rel: "stylesheet"
|
11
|
+
static rel: "stylesheet", type: "text/css"
|
12
12
|
content_types "text/css"
|
13
|
-
static type: "text/css"
|
14
13
|
|
14
|
+
# --
|
15
15
|
def set_href
|
16
|
+
return if @args[:inline]
|
16
17
|
return @args[:href] = @asset.url if @asset.is_a?(Url)
|
17
18
|
@args[:href] = @env.prefix_url(@asset
|
18
19
|
.digest_path)
|
19
20
|
end
|
20
21
|
|
22
|
+
# --
|
21
23
|
def set_integrity
|
22
24
|
return unless integrity?
|
23
25
|
@args[:integrity] = @asset.integrity
|
@@ -8,15 +8,9 @@ module Jekyll
|
|
8
8
|
module Assets
|
9
9
|
class Default
|
10
10
|
class Img < Default
|
11
|
-
content_types
|
12
|
-
content_types "image/webp"
|
13
|
-
content_types "image/svg+xml"
|
14
|
-
content_types "image/jpeg"
|
15
|
-
content_types "image/tiff"
|
16
|
-
content_types "image/gif"
|
17
|
-
content_types "image/png"
|
18
|
-
content_types "image/jpg"
|
11
|
+
content_types %r!^image/(?\!x-icon$)[a-zA-Z0-9\-_]+$!
|
19
12
|
|
13
|
+
# --
|
20
14
|
def set_src
|
21
15
|
dpath = @asset.digest_path
|
22
16
|
return @args[:src] = @asset.url if @asset.is_a?(Url)
|
@@ -24,6 +18,7 @@ module Jekyll
|
|
24
18
|
@args[:src] = @asset.data_uri
|
25
19
|
end
|
26
20
|
|
21
|
+
# --
|
27
22
|
def set_integrity
|
28
23
|
return unless integrity?
|
29
24
|
@args[:integrity] = @asset.integrity
|
@@ -8,16 +8,18 @@ module Jekyll
|
|
8
8
|
module Assets
|
9
9
|
class Default
|
10
10
|
class JS < Default
|
11
|
-
content_types "text/javascript"
|
12
11
|
content_types "application/javascript"
|
13
12
|
static type: "text/javascript"
|
14
13
|
|
14
|
+
# --
|
15
15
|
def set_src
|
16
|
+
return if @args[:inline]
|
16
17
|
return @args[:src] = @asset.url if @asset.is_a?(Url)
|
17
18
|
@args[:src] = @env.prefix_url(@asset
|
18
19
|
.digest_path)
|
19
20
|
end
|
20
21
|
|
22
|
+
# --
|
21
23
|
def set_integrity
|
22
24
|
return unless integrity?
|
23
25
|
@args[:integrity] = @asset.integrity
|
@@ -9,14 +9,7 @@ module Jekyll
|
|
9
9
|
module Assets
|
10
10
|
class HTML
|
11
11
|
class IMG < HTML
|
12
|
-
content_types
|
13
|
-
content_types "image/webp"
|
14
|
-
content_types "image/svg+xml"
|
15
|
-
content_types "image/jpeg"
|
16
|
-
content_types "image/tiff"
|
17
|
-
content_types "image/gif"
|
18
|
-
content_types "image/png"
|
19
|
-
content_types "image/jpg"
|
12
|
+
content_types %r!^image/(?\!x-icon$)[a-zA-Z0-9\-_]+$!
|
20
13
|
|
21
14
|
# --
|
22
15
|
def run
|
@@ -9,9 +9,9 @@ module Jekyll
|
|
9
9
|
module Assets
|
10
10
|
class HTML
|
11
11
|
class JS < HTML
|
12
|
-
content_types "application/javascript"
|
13
|
-
"text/javascript"
|
12
|
+
content_types "application/javascript"
|
14
13
|
|
14
|
+
# --
|
15
15
|
def run
|
16
16
|
if @asset.is_a?(Url) && @args[:inline]
|
17
17
|
raise Tag::MixedArg, "@external", "@inline"
|
@@ -9,14 +9,7 @@ module Jekyll
|
|
9
9
|
module Assets
|
10
10
|
class HTML
|
11
11
|
class Pic < HTML
|
12
|
-
content_types
|
13
|
-
content_types "image/jpeg"
|
14
|
-
content_types "image/tiff"
|
15
|
-
content_types "image/svg+xml"
|
16
|
-
content_types "image/bmp"
|
17
|
-
content_types "image/gif"
|
18
|
-
content_types "image/png"
|
19
|
-
content_types "image/jpg"
|
12
|
+
content_types %r!^image/(?\!x-icon$)[a-zA-Z0-9\-_]+$!
|
20
13
|
|
21
14
|
# --
|
22
15
|
# @todo this should be reworked so we don't need to use
|
@@ -9,10 +9,9 @@ module Jekyll
|
|
9
9
|
module Assets
|
10
10
|
class HTML
|
11
11
|
class Video < HTML
|
12
|
-
content_types
|
13
|
-
content_types "video/webm"
|
14
|
-
content_types "video/mp4"
|
12
|
+
content_types %r!^video/.*$!
|
15
13
|
|
14
|
+
# --
|
16
15
|
def run
|
17
16
|
Nokogiri::HTML::Builder.with(doc) do |d|
|
18
17
|
d.video("No support for video.", args.to_h({
|
data/lib/jekyll/assets/tag.rb
CHANGED
@@ -160,7 +160,7 @@ module Jekyll
|
|
160
160
|
original = env.find_asset!(args[:argv1])
|
161
161
|
Default.set(args, ctx: ctx, asset: original)
|
162
162
|
out = Proxy.proxy(original, args: args, ctx: ctx)
|
163
|
-
env.
|
163
|
+
env.assets_to_write |= [out.logical_path]
|
164
164
|
|
165
165
|
Default.set(args, {
|
166
166
|
ctx: ctx, asset: out
|
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.4
|
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: 2017-
|
13
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: execjs
|