jekyll-minibundle 2.0.1 → 2.1.0
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/CHANGELOG.md +6 -0
- data/README.md +7 -5
- data/lib/jekyll/minibundle/asset_tag_markup.rb +5 -1
- data/lib/jekyll/minibundle/version.rb +1 -1
- data/test/fixture/site/_layouts/default.html +1 -0
- data/test/integration/minibundle_development_mode_test.rb +2 -2
- data/test/integration/minibundle_production_mode_test.rb +3 -0
- data/test/unit/asset_tag_markup_test.rb +22 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0e8eb69fc25d07f84cdd00cebe04669a4f0a09c
|
4
|
+
data.tar.gz: 3469c040798e5add50f205cd0327d10d8083743a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4953977ee09c4cdaf507b1c1f6a231e7778be1c9a84843968bd7e471baf678a3a4edf601b71d61f3b178dc63d1b72271ed291c4b23961d93790aae28175a7f1c
|
7
|
+
data.tar.gz: edcfeee786bbb756434e9e7576936891681060f92d90544e2cbef2367a230966c99eb289e3e3c24109e4d8f2ff2d06e5507131c727793dc099aad514815520b2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 2.1.0 / 2016-05-04
|
2
|
+
|
3
|
+
* Allow attributes without values. Useful for `async` attribute, for
|
4
|
+
example. Pull Request #7 by Sam (@codewisdom).
|
5
|
+
* Ensure attribute value conversion to string
|
6
|
+
|
1
7
|
# 2.0.1 / 2016-04-06
|
2
8
|
|
3
9
|
* Fix Jekyll version requirement check to be more reliable
|
data/README.md
CHANGED
@@ -124,6 +124,7 @@ assets:
|
|
124
124
|
- app
|
125
125
|
attributes:
|
126
126
|
id: my-scripts
|
127
|
+
async:
|
127
128
|
{% endminibundle %}
|
128
129
|
```
|
129
130
|
|
@@ -140,14 +141,15 @@ minibundle:
|
|
140
141
|
Output in the content file:
|
141
142
|
|
142
143
|
``` html
|
143
|
-
<script src="/assets/site-8e764372a0dbd296033cb2a416f064b5.js" type="text/javascript" id="my-scripts"></script>
|
144
|
+
<script src="/assets/site-8e764372a0dbd296033cb2a416f064b5.js" type="text/javascript" id="my-scripts" async></script>
|
144
145
|
```
|
145
146
|
|
146
|
-
You can pass custom attributes, like `id="my-scripts"`
|
147
|
-
generated markup with `attributes` map inside the
|
147
|
+
You can pass custom attributes, like `id="my-scripts"` and `async`
|
148
|
+
above, to the generated markup with `attributes` map inside the
|
149
|
+
`minibundle` block.
|
148
150
|
|
149
|
-
For bundling CSS assets,
|
150
|
-
|
151
|
+
For bundling CSS assets, use `css` as the argument to the `minibundle`
|
152
|
+
block:
|
151
153
|
|
152
154
|
``` text
|
153
155
|
{% minibundle css %}
|
@@ -29,8 +29,8 @@ module Jekyll::Minibundle::Test
|
|
29
29
|
|
30
30
|
def test_js_assets_have_configured_attributes
|
31
31
|
with_precompiled_site(:development) do
|
32
|
-
elements = find_js_elements_from_index.map { |el| el['id'] }.uniq
|
33
|
-
assert_equal ['my-scripts'], elements
|
32
|
+
elements = find_js_elements_from_index.map { |el| [el['id'], el['async']] }.uniq
|
33
|
+
assert_equal [['my-scripts', '']], elements
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -29,6 +29,7 @@ module Jekyll::Minibundle::Test
|
|
29
29
|
with_precompiled_site(:production) do
|
30
30
|
element = find_js_element_from_index
|
31
31
|
assert_equal 'my-scripts', element['id']
|
32
|
+
assert_equal '', element['async']
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
@@ -240,6 +241,8 @@ module Jekyll::Minibundle::Test
|
|
240
241
|
|
241
242
|
generate_site(:production, clear_cache: false)
|
242
243
|
|
244
|
+
sleep 1 # wait for unlinked temp files to actually disappear
|
245
|
+
|
243
246
|
refute File.exist?(destination_path(JS_BUNDLE_DESTINATION_FINGERPRINT_PATH))
|
244
247
|
assert File.exist?(destination_path("assets/site2-#{JS_BUNDLE_FINGERPRINT}.js"))
|
245
248
|
assert_equal 1, (org_tempfiles - find_tempfiles).size
|
@@ -3,13 +3,31 @@ require 'jekyll/minibundle/asset_tag_markup'
|
|
3
3
|
|
4
4
|
module Jekyll::Minibundle::Test
|
5
5
|
class AssetTagMarkupTest < TestCase
|
6
|
-
def
|
6
|
+
def test_escape_attribute_value
|
7
7
|
attributes = {media: 'screen, projection', extra: '">attack<br'}
|
8
8
|
actual = AssetTagMarkup.make_markup(:css, '', '/asset.css', attributes)
|
9
9
|
expected = %{<link rel="stylesheet" href="/asset.css" media="screen, projection" extra="">attack<br">}
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
12
12
|
|
13
|
+
def test_output_just_attribute_name_for_nil_value
|
14
|
+
actual = AssetTagMarkup.make_markup(:css, '', '/asset.css', async: nil)
|
15
|
+
expected = %{<link rel="stylesheet" href="/asset.css" async>}
|
16
|
+
assert_equal expected, actual
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_convert_attribute_value_to_string
|
20
|
+
actual = AssetTagMarkup.make_markup(:css, '', '/asset.css', boolean: false)
|
21
|
+
expected = %{<link rel="stylesheet" href="/asset.css" boolean="false">}
|
22
|
+
assert_equal expected, actual
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_output_empty_attribute_value
|
26
|
+
actual = AssetTagMarkup.make_markup(:css, '', '/asset.css', empty: '')
|
27
|
+
expected = %{<link rel="stylesheet" href="/asset.css" empty="">}
|
28
|
+
assert_equal expected, actual
|
29
|
+
end
|
30
|
+
|
13
31
|
def test_raise_exception_if_unknown_type
|
14
32
|
err = assert_raises(ArgumentError) do
|
15
33
|
AssetTagMarkup.make_markup(:unknown, '', '/asset', {})
|
@@ -17,15 +35,15 @@ module Jekyll::Minibundle::Test
|
|
17
35
|
assert_equal 'Unknown type for generating bundle markup: unknown, /asset', err.to_s
|
18
36
|
end
|
19
37
|
|
20
|
-
def
|
38
|
+
def test_join_empty_baseurl_and_path
|
21
39
|
assert_equal %{<link rel="stylesheet" href="asset.css">}, AssetTagMarkup.make_markup(:css, '', 'asset.css', {})
|
22
40
|
end
|
23
41
|
|
24
|
-
def
|
42
|
+
def test_join_nonempty_baseurl_and_path
|
25
43
|
assert_equal %{<link rel="stylesheet" href="/root/path/asset.css">}, AssetTagMarkup.make_markup(:css, '/root', 'path/asset.css', {})
|
26
44
|
end
|
27
45
|
|
28
|
-
def
|
46
|
+
def test_remove_extra_slash_between_baseurl_and_path
|
29
47
|
assert_equal %{<link rel="stylesheet" href="/asset.css">}, AssetTagMarkup.make_markup(:css, '/', '/asset.css', {})
|
30
48
|
end
|
31
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-minibundle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tuomas Kareinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.6.
|
178
|
+
rubygems_version: 2.6.4
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: A minimalistic asset bundling plugin for Jekyll
|