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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce45ad23c704195b61891db09c7f3d5e49c8152d5203d3ef1fb777eb82fa5c64
4
- data.tar.gz: acdc459add9164deac556f9a018ae473f9393a1c93a1c42176f9a8c783210079
3
+ metadata.gz: 05cd13c82fadc3c86b4d801b9add765ebf4550be874835c5e72bb3a52af0b2b8
4
+ data.tar.gz: 8481c677ec9ea09c2b13d56ff5fc1c251a7f982725094e4b92c16331578e264a
5
5
  SHA512:
6
- metadata.gz: 61e538c18026d13670756d41339abf91e41665e726ecf35f4a5aa9eff9f611febe9d3db84cb3686942bc414e23608d4baadc66fd84ef9445ab9439d2802301ba
7
- data.tar.gz: e83ebbe0089fc6b435d40e40d7512e5ee3836f511d4765333b1282ff94651ccb11bd776c72e674707d700f80ebdd758504f213f02d52caea7a268ae417a725fb
6
+ metadata.gz: 3e4618cfd1c9a52f8e2628c41f9c5869cfaee9695f2b9d21137d0622688b71dd3d3511faab48bf584997be2ec8b0d81e983fc826a6b073cd1854470922410450
7
+ data.tar.gz: 263130438147471d34412b6a15a6b14b8b645444589c2b68866314ba58b2e532e22554e413eae14599b2f6a84551b686575762cb93aa4009a057ee69691d5a25
data/.rubocop.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 3.2
3
+ SuggestExtensions: false
3
4
 
4
5
  Style/StringLiterals:
5
6
  EnforcedStyle: double_quotes
data/CHANGELOG.md CHANGED
@@ -23,4 +23,8 @@
23
23
  - woff2
24
24
  - ttf
25
25
  - otf
26
- - Added Source selection
26
+ - Added Source selection
27
+
28
+ ## [1.2.0] - 2025-06-06
29
+
30
+ - Added option to select formats
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
- formats:
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
- extension = asset.split(".").last
17
- asset_link = format_string(extension) % asset
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(extension)
25
+ def format_string(link_format)
26
26
  formats ||= formats_merge(DEFAULT_FORMATS, @config["formats"])
27
- formats[extension] || "%s"
27
+ formats[link_format] || "%s"
28
28
  end
29
29
 
30
30
  def formats_merge(default, custom)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllDynamicAssets
4
- VERSION = "1.1.0"
4
+ VERSION = "1.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_dynamic_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. Umar Shahbaz