jekyll_dynamic_assets 1.1.0 → 1.2.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/.rubocop.yml +1 -0
- data/CHANGELOG.md +5 -1
- data/README.md +9 -4
- data/lib/jekyll_dynamic_assets/processor.rb +4 -4
- data/lib/jekyll_dynamic_assets/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05cd13c82fadc3c86b4d801b9add765ebf4550be874835c5e72bb3a52af0b2b8
|
4
|
+
data.tar.gz: 8481c677ec9ea09c2b13d56ff5fc1c251a7f982725094e4b92c16331578e264a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e4618cfd1c9a52f8e2628c41f9c5869cfaee9695f2b9d21137d0622688b71dd3d3511faab48bf584997be2ec8b0d81e983fc826a6b073cd1854470922410450
|
7
|
+
data.tar.gz: 263130438147471d34412b6a15a6b14b8b645444589c2b68866314ba58b2e532e22554e413eae14599b2f6a84551b686575762cb93aa4009a057ee69691d5a25
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,7 @@ JekyllDynamicAssets is a Jekyll plugin that allows you to dynamically manage and
|
|
6
6
|
- Define global (master) assets and per-page assets
|
7
7
|
- Use asset presets for reusable asset groups
|
8
8
|
- Pre-defined default formats for common assets, can be overwritten
|
9
|
+
- Auto and Manual select formats
|
9
10
|
- Liquid tag `{% assets %}` for easy asset injection in templates and includes
|
10
11
|
- Error reporting for missing presets
|
11
12
|
|
@@ -46,13 +47,16 @@ assets:
|
|
46
47
|
master: # Master assets
|
47
48
|
- main.css
|
48
49
|
- main.js
|
49
|
-
source: "/assets/" # Optional: base path for all assets
|
50
|
-
|
51
|
-
js: "<script defer src='%s'></script>" # Overwrite defaults
|
52
|
-
xyz: "<custom> %s </custom>" # Define Custom formats
|
50
|
+
source: "/assets/" # Optional: base path for all assets, skips assets starting with http
|
51
|
+
|
53
52
|
presets: # Create presets to include multiple assets
|
54
53
|
blog: [blog.css, blog.js]
|
55
54
|
project: [project.css, project.js, code-highlight.css, slideshow.js, myApp.js]
|
55
|
+
|
56
|
+
formats:
|
57
|
+
js: <script defer src='%s'></script> # Overwrite defaults
|
58
|
+
xyz: <custom> %s </custom> # Define Custom formats
|
59
|
+
screen-css: <link rel="stylesheet" href="%s" media="screen">
|
56
60
|
```
|
57
61
|
|
58
62
|
2. **Per-page or per-collection configuration:**
|
@@ -63,6 +67,7 @@ In your page or post front matter:
|
|
63
67
|
assets:
|
64
68
|
files:
|
65
69
|
- manual.css # include singular files
|
70
|
+
- onscreen.css::screen-css # Use :: to select a format, default format is determined by file extension
|
66
71
|
presets:
|
67
72
|
- blog # Use a preset
|
68
73
|
```
|
@@ -13,8 +13,8 @@ module JekyllDynamicAssets
|
|
13
13
|
all_assets = combined_assets
|
14
14
|
asset_insertions = []
|
15
15
|
all_assets.each do |asset|
|
16
|
-
|
17
|
-
asset_link = format_string(
|
16
|
+
link_format = asset.include?("::") ? asset.split("::").last : asset.split(".").last
|
17
|
+
asset_link = format_string(link_format) % asset.split("::").first
|
18
18
|
asset_insertions << asset_link
|
19
19
|
end
|
20
20
|
asset_insertions
|
@@ -22,9 +22,9 @@ module JekyllDynamicAssets
|
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
def format_string(
|
25
|
+
def format_string(link_format)
|
26
26
|
formats ||= formats_merge(DEFAULT_FORMATS, @config["formats"])
|
27
|
-
formats[
|
27
|
+
formats[link_format] || "%s"
|
28
28
|
end
|
29
29
|
|
30
30
|
def formats_merge(default, custom)
|