jekyll_dynamic_assets 1.3.0 → 1.3.2

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: 8f4102ebcc09a9c91ad535a06179560476217a410d75511df6fd78762b2227c5
4
- data.tar.gz: 1255d4fc1b4de77e09c30d9d388fa7f0dd6f75c0ba65a1ef3c35ecc3314cbf75
3
+ metadata.gz: 33ea0b62047174971e928d2ba49e28cf90b4a719174b068958048d2e213476a2
4
+ data.tar.gz: 42aa3c760080e243521189afc839e9d71f0f0b2e56a6a855d7096a23e370ec11
5
5
  SHA512:
6
- metadata.gz: 5543ce35aeb57e5aa44624e89dbb2393863fd1b80e3d1d1ac1394dd6463cc428f6756b4f416d447c629797f92d00b4d37128feb2eec0ca2ced1aa3ebab69f8b3
7
- data.tar.gz: 3586a4f15eaabc0acdfbffe6e8080069f809f6f64ad5c71e2f56a801b3a352d85b9db6d62f44fee3015c1351d6aad6b85d975a7909430e31a7303b855379774d
6
+ metadata.gz: 4ceff87e25766674d19f1fc28b88323152a6703cfb6b770a2080c920e530fd7cea6f9f722ecfe8316a8077d47fd7701c938cf545bb6f0d92fd0520fe2b106fed
7
+ data.tar.gz: 9f4147c664e3362065e788fd7a735cbe068f32f8e338b4f21a85c411bebc7bd87902c174313105e14241db891f4361054defd9437af33462210d4cbf19b3989b
data/.bundle/config ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_FROZEN: "false"
data/.rubocop.yml CHANGED
@@ -1,24 +1,24 @@
1
- AllCops:
2
- TargetRubyVersion: 3.2
3
- SuggestExtensions: false
4
-
5
- Style/StringLiterals:
6
- EnforcedStyle: double_quotes
7
-
8
- Style/StringLiteralsInInterpolation:
9
- EnforcedStyle: double_quotes
10
-
11
- Metrics/MethodLength:
12
- Enabled: false
13
-
14
- Layout/LineLength:
15
- Enabled: false
16
-
17
- Lint/ScriptPermission:
18
- Enabled: false
19
-
20
- Layout/EndOfLine:
21
- Enabled: false
22
-
23
- Metrics/ClassLength:
1
+ AllCops:
2
+ TargetRubyVersion: 3.2
3
+ SuggestExtensions: false
4
+
5
+ Style/StringLiterals:
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ EnforcedStyle: double_quotes
10
+
11
+ Metrics/MethodLength:
12
+ Enabled: false
13
+
14
+ Layout/LineLength:
15
+ Enabled: false
16
+
17
+ Lint/ScriptPermission:
18
+ Enabled: false
19
+
20
+ Layout/EndOfLine:
21
+ Enabled: false
22
+
23
+ Metrics/ClassLength:
24
24
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,47 +1,54 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2025-06-05
4
-
5
- - Test release
6
-
7
- ## [Released]
8
-
9
- ## [1.0.0] - 2025-06-05
10
-
11
- - Initial release
12
-
13
- ## [1.1.0] - 2025-06-06
14
-
15
- - Added Default Formats for the following:
16
- - css
17
- - js
18
- - mjs
19
- - ts
20
- - json
21
- - ico
22
- - woff
23
- - woff2
24
- - ttf
25
- - otf
26
- - Added Source selection
27
-
28
- ## [1.2.0] - 2025-06-06
29
-
30
- - Added option to select formats
31
-
32
- ## [1.3.0] - 2025-06-07
33
-
34
- - Added Sub directory options
35
- - Added Default Sub directories for
36
- - css >> styles
37
- - js >> scripts
38
- - mjs >> scripts
39
- - ts >> scripts
40
- - json >> data
41
- - ico >> icons
42
- - woff >> fonts
43
- - woff2 >> fonts
44
- - ttf >> fonts
45
- - otf >> fonts
46
- - Updated Selection logic, added inline definition
47
- - Added Absolute URL
1
+ # [Released]
2
+
3
+ ## [1.3.2] - 2025-07-23
4
+ - Added external base option
5
+
6
+ ## [1.3.1] - 2025-06-08
7
+
8
+ - Resolved conflicts with `jekyll-assets`
9
+
10
+ ## [1.3.0] - 2025-06-07
11
+
12
+ - Added Sub directory options
13
+ - Added Default Sub directories for
14
+ - css >> styles
15
+ - js >> scripts
16
+ - mjs >> scripts
17
+ - ts >> scripts
18
+ - json >> data
19
+ - ico >> icons
20
+ - woff >> fonts
21
+ - woff2 >> fonts
22
+ - ttf >> fonts
23
+ - otf >> fonts
24
+ - Updated Selection logic, added inline definition
25
+ - Added Absolute URL
26
+
27
+ ## [1.2.0] - 2025-06-06
28
+
29
+ - Added option to select formats
30
+
31
+ ## [1.1.0] - 2025-06-06
32
+
33
+ - Added Default Formats for the following:
34
+ - css
35
+ - js
36
+ - mjs
37
+ - ts
38
+ - json
39
+ - ico
40
+ - woff
41
+ - woff2
42
+ - ttf
43
+ - otf
44
+ - Added Source selection
45
+
46
+ ## [1.0.0] - 2025-06-05
47
+
48
+ - Initial release
49
+
50
+ # [Unreleased]
51
+
52
+ ## [0.1.0] - 2025-06-05
53
+
54
+ - Test release
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,132 +1,132 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, caste, color, religion, or sexual
10
- identity and orientation.
11
-
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
19
-
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the overall
26
- community
27
-
28
- Examples of unacceptable behavior include:
29
-
30
- * The use of sexualized language or imagery, and sexual attention or advances of
31
- any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email address,
35
- without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
38
-
39
- ## Enforcement Responsibilities
40
-
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
45
-
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
50
-
51
- ## Scope
52
-
53
- This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official email address,
56
- posting via an official social media account, or acting as an appointed
57
- representative at an online or offline event.
58
-
59
- ## Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at
63
- [INSERT CONTACT METHOD].
64
- All complaints will be reviewed and investigated promptly and fairly.
65
-
66
- All community leaders are obligated to respect the privacy and security of the
67
- reporter of any incident.
68
-
69
- ## Enforcement Guidelines
70
-
71
- Community leaders will follow these Community Impact Guidelines in determining
72
- the consequences for any action they deem in violation of this Code of Conduct:
73
-
74
- ### 1. Correction
75
-
76
- **Community Impact**: Use of inappropriate language or other behavior deemed
77
- unprofessional or unwelcome in the community.
78
-
79
- **Consequence**: A private, written warning from community leaders, providing
80
- clarity around the nature of the violation and an explanation of why the
81
- behavior was inappropriate. A public apology may be requested.
82
-
83
- ### 2. Warning
84
-
85
- **Community Impact**: A violation through a single incident or series of
86
- actions.
87
-
88
- **Consequence**: A warning with consequences for continued behavior. No
89
- interaction with the people involved, including unsolicited interaction with
90
- those enforcing the Code of Conduct, for a specified period of time. This
91
- includes avoiding interactions in community spaces as well as external channels
92
- like social media. Violating these terms may lead to a temporary or permanent
93
- ban.
94
-
95
- ### 3. Temporary Ban
96
-
97
- **Community Impact**: A serious violation of community standards, including
98
- sustained inappropriate behavior.
99
-
100
- **Consequence**: A temporary ban from any sort of interaction or public
101
- communication with the community for a specified period of time. No public or
102
- private interaction with the people involved, including unsolicited interaction
103
- with those enforcing the Code of Conduct, is allowed during this period.
104
- Violating these terms may lead to a permanent ban.
105
-
106
- ### 4. Permanent Ban
107
-
108
- **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
110
- individual, or aggression toward or disparagement of classes of individuals.
111
-
112
- **Consequence**: A permanent ban from any sort of public interaction within the
113
- community.
114
-
115
- ## Attribution
116
-
117
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
- version 2.1, available at
119
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
-
121
- Community Impact Guidelines were inspired by
122
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
-
124
- For answers to common questions about this code of conduct, see the FAQ at
125
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
- [https://www.contributor-covenant.org/translations][translations].
127
-
128
- [homepage]: https://www.contributor-covenant.org
129
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
- [Mozilla CoC]: https://github.com/mozilla/diversity
131
- [FAQ]: https://www.contributor-covenant.org/faq
132
- [translations]: https://www.contributor-covenant.org/translations
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2025 M. Umar Shahbaz
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 M. Umar Shahbaz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,140 +1,140 @@
1
- # JekyllDynamicAssets
2
-
3
- JekyllDynamicAssets is a powerful Jekyll plugin for dynamic, flexible, and DRY asset management. It lets you define, group, and inject CSS, JS, and other head assets using presets, per-page config, and custom formatting.
4
-
5
- ## Features
6
- - Define global (master) assets and per-page assets
7
- - Use asset presets for reusable asset groups
8
- - Pre-defined and overrideable formats and sources for common assets
9
- - Auto, Select, and Inline formats and sources
10
- - Liquid tag `{% assets %}` for easy asset injection in templates and includes
11
- - Error reporting for missing presets and formats
12
- - Absolute/relative URL support
13
- - Supports all head assets: CSS, JS, module JS, fonts, icons, JSON, etc.
14
-
15
- ## Installation
16
-
17
- Add this to your Jekyll site's `Gemfile`:
18
-
19
- ```ruby
20
- source 'https://rubygems.org'
21
-
22
- gem "jekyll"
23
-
24
- group :jekyll_plugins do
25
- gem "jekyll_dynamic_assets"
26
- # other gems
27
- end
28
- ```
29
-
30
- Then add the following to your Jekyll site's `config.yml`:
31
-
32
- ```yaml
33
- plugins:
34
- - jekyll_dynamic_assets
35
- ```
36
-
37
- Finally, in your terminal run:
38
-
39
- ```powershell
40
- bundle install
41
- ```
42
-
43
- ## Usage
44
-
45
- ### 1. Configure your assets in `config.yml`
46
-
47
- ```yaml
48
- assets:
49
- master:
50
- - main.css
51
- - main.js
52
-
53
- source:
54
- base: /assets
55
- github: https://github.com/assets/
56
- css: /css
57
- js: /js
58
- absolute: true # Use absolute URLs (uses `url` and `baseurl` from config)
59
-
60
- presets:
61
- blog: [blog.css, blog.js]
62
- project: [project.css, project.js, code-highlight.css, slideshow.js, myApp.js]
63
-
64
- formats:
65
- js: <script defer src='%s'></script>
66
- xyz: <custom> %s </custom>
67
- screen-css: <link rel="stylesheet" href="%s" media="screen">
68
- ```
69
-
70
- If all your assets are in the same folder, you can simply do:
71
-
72
- ```yaml
73
- assets:
74
- source: /asset_folder
75
- ```
76
-
77
- **Path rules:** Always use a leading slash, never a trailing slash.
78
-
79
- ### 2. Per-page or per-collection configuration
80
-
81
- In your page or post front matter:
82
-
83
- ```yaml
84
- assets:
85
- files: # See Asset Definition Syntax below
86
- - manual.css
87
- - onscreen.css::screen-css
88
- - no_script.css:::<noscript><link rel="stylesheet" href="%s"></noscript>
89
- - github<<master.css
90
- - /css/new<<<new-main.css
91
- presets:
92
- - blog
93
- - project
94
- ```
95
-
96
- ### 3. Inject assets in your templates
97
-
98
- Use the Liquid tag where you want the assets to appear (typically in your `<head>`):
99
-
100
- ```liquid
101
- <head>
102
- <!-- other tags like meta etc. -->
103
- {% assets %}
104
- </head>
105
- ```
106
-
107
- This will output the appropriate HTML tags for all configured assets. The tag should generally be used inside your `<head>` tag but can be used anywhere else.
108
-
109
- ---
110
-
111
- ### Asset Definition Syntax
112
-
113
- You can use the following syntax anywhere (config or front matter):
114
-
115
- ```
116
- Source<<Asset::Format
117
- ```
118
-
119
- - `<<` uses `Source` as a variable from config; `<<<` uses `Source` as a literal.
120
- - `::` uses `Format` as a variable from config; `:::` uses `Format` as a literal.
121
- - If either is not defined, source/format is taken from config using the file extension.
122
- - If the source is not external, it will be determined using `base + Source`.
123
-
124
- **NOTE:**
125
- - If JDA can't find a source, it will use the `base` without sub-directories.
126
- - If JDA can't find the format, it will raise an error. A format is required for each asset.
127
-
128
- ---
129
-
130
- ## Contributing
131
-
132
- Bug reports and pull requests are welcome on GitHub at https://github.com/MUmarShahbaz/jekyll_dynamic_assets. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/MUmarShahbaz/jekyll_dynamic_assets/blob/main/CODE_OF_CONDUCT.md).
133
-
134
- ## License
135
-
136
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
137
-
138
- ## Code of Conduct
139
-
140
- Everyone interacting in the JekyllDynamicAssets project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/MUmarShahbaz/jekyll_dynamic_assets/blob/main/CODE_OF_CONDUCT.md).
1
+ # JekyllDynamicAssets
2
+
3
+ JekyllDynamicAssets is a powerful Jekyll plugin for dynamic, flexible, and DRY asset management. It lets you define, group, and inject CSS, JS, and other head assets using presets, per-page config, and custom formatting.
4
+
5
+ ## Features
6
+ - Define global (master) assets and per-page assets
7
+ - Use asset presets for reusable asset groups
8
+ - Pre-defined and overrideable formats and sources for common assets
9
+ - Auto, Select, and Inline formats and sources
10
+ - Liquid tag `{% inject_assets %}` for easy asset injection in templates and includes
11
+ - Error reporting for missing presets and formats
12
+ - Absolute/relative URL support
13
+ - Supports all head assets: CSS, JS, module JS, fonts, icons, JSON, etc.
14
+
15
+ ## Installation
16
+
17
+ Add this to your Jekyll site's `Gemfile`:
18
+
19
+ ```ruby
20
+ source 'https://rubygems.org'
21
+
22
+ gem "jekyll"
23
+
24
+ group :jekyll_plugins do
25
+ gem "jekyll_dynamic_assets"
26
+ # other gems
27
+ end
28
+ ```
29
+
30
+ Then add the following to your Jekyll site's `config.yml`:
31
+
32
+ ```yaml
33
+ plugins:
34
+ - jekyll_dynamic_assets
35
+ ```
36
+
37
+ Finally, in your terminal run:
38
+
39
+ ```powershell
40
+ bundle install
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ ### 1. Configure your assets in `config.yml`
46
+
47
+ ```yaml
48
+ dynamic_assets:
49
+ master:
50
+ - main.css
51
+ - main.js
52
+
53
+ source:
54
+ base: /assets
55
+ github: https://github.com/assets/
56
+ css: /css
57
+ js: /js
58
+ absolute: true # Use absolute URLs (uses `url` and `baseurl` from config)
59
+
60
+ presets:
61
+ blog: [blog.css, blog.js]
62
+ project: [project.css, project.js, code-highlight.css, slideshow.js, myApp.js]
63
+
64
+ formats:
65
+ js: <script defer src='%s'></script>
66
+ xyz: <custom> %s </custom>
67
+ screen-css: <link rel="stylesheet" href="%s" media="screen">
68
+ ```
69
+
70
+ If all your assets are in the same folder, you can simply do:
71
+
72
+ ```yaml
73
+ dynamic_assets:
74
+ source: /asset_folder
75
+ ```
76
+
77
+ **Path rules:** Always use a leading slash, never a trailing slash.
78
+
79
+ ### 2. Per-page or per-collection configuration
80
+
81
+ In your page or post front matter:
82
+
83
+ ```yaml
84
+ dynamic_assets:
85
+ files: # See Asset Definition Syntax below
86
+ - manual.css
87
+ - onscreen.css::screen-css
88
+ - no_script.css:::<noscript><link rel="stylesheet" href="%s"></noscript>
89
+ - github<<master.css
90
+ - /css/new<<<new-main.css
91
+ presets:
92
+ - blog
93
+ - project
94
+ ```
95
+
96
+ ### 3. Inject assets in your templates
97
+
98
+ Use the Liquid tag where you want the assets to appear (typically in your `<head>`):
99
+
100
+ ```liquid
101
+ <head>
102
+ <!-- other tags like meta etc. -->
103
+ {% inject_assets %}
104
+ </head>
105
+ ```
106
+
107
+ This will output the appropriate HTML tags for all configured assets. The tag should generally be used inside your `<head>` tag but can be used anywhere else.
108
+
109
+ ---
110
+
111
+ ### Asset Definition Syntax
112
+
113
+ You can use the following syntax anywhere (config or front matter):
114
+
115
+ ```
116
+ Source<<Asset::Format
117
+ ```
118
+
119
+ - `<<` uses `Source` as a variable from config; `<<<` uses `Source` as a literal.
120
+ - `::` uses `Format` as a variable from config; `:::` uses `Format` as a literal.
121
+ - If either is not defined, source/format is taken from config using the file extension.
122
+ - If the source is not external, it will be determined using `base + Source`.
123
+
124
+ **NOTE:**
125
+ - If JDA can't find a source, it will use the `base` without sub-directories.
126
+ - If JDA can't find the format, it will raise an error. A format is required for each asset.
127
+
128
+ ---
129
+
130
+ ## Contributing
131
+
132
+ Bug reports and pull requests are welcome on GitHub at https://github.com/MUmarShahbaz/jekyll_dynamic_assets. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/MUmarShahbaz/jekyll_dynamic_assets/blob/main/CODE_OF_CONDUCT.md).
133
+
134
+ ## License
135
+
136
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
137
+
138
+ ## Code of Conduct
139
+
140
+ Everyone interacting in the JekyllDynamicAssets project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/MUmarShahbaz/jekyll_dynamic_assets/blob/main/CODE_OF_CONDUCT.md).
@@ -3,7 +3,7 @@
3
3
  require "liquid"
4
4
 
5
5
  module JekyllDynamicAssets
6
- # {% assets %} tag
6
+ # {% inject_assets %} tag
7
7
  class AssetsTag < Liquid::Tag
8
8
  def render(context)
9
9
  site = context.registers[:site]
@@ -4,9 +4,9 @@ module JekyllDynamicAssets
4
4
  # Asset link generator
5
5
  class Processor
6
6
  def initialize(site:, page:)
7
- @config = site.config["assets"] || {}
7
+ @config = site.config["dynamic_assets"] || {}
8
8
  @page = page
9
- @page_config = page["assets"] || {}
9
+ @page_config = page["dynamic_assets"] || {}
10
10
  @path = @page["path"] || @page["relative_path"] || "unknown"
11
11
 
12
12
  sub_configs(site:)
@@ -59,7 +59,7 @@ module JekyllDynamicAssets
59
59
 
60
60
  def prepare_dir(dir)
61
61
  # Format URL assuming standard inputs, all leading slashes and no trailing
62
- directory = @config["absolute"] ? @url : ""
62
+ directory = @config["absolute"] && !@asset_sources["base"].start_with?("http") ? @url : ""
63
63
  directory += @asset_sources["base"] unless @asset_sources["base"] == ""
64
64
  directory += dir unless dir.empty? || dir == ""
65
65
  directory += "/"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllDynamicAssets
4
- VERSION = "1.3.0"
4
+ VERSION = "1.3.2"
5
5
  end
@@ -10,4 +10,4 @@ module JekyllDynamicAssets
10
10
  class Error < StandardError; end
11
11
  end
12
12
 
13
- Liquid::Template.register_tag("assets", JekyllDynamicAssets::AssetsTag)
13
+ Liquid::Template.register_tag("inject_assets", JekyllDynamicAssets::AssetsTag)
@@ -1,4 +1,4 @@
1
- module JekyllDynamicAssets
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end
1
+ module JekyllDynamicAssets
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_dynamic_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. Umar Shahbaz
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-06-07 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: jekyll
@@ -58,6 +57,7 @@ executables: []
58
57
  extensions: []
59
58
  extra_rdoc_files: []
60
59
  files:
60
+ - ".bundle/config"
61
61
  - ".rubocop.yml"
62
62
  - CHANGELOG.md
63
63
  - CODE_OF_CONDUCT.md
@@ -78,7 +78,6 @@ metadata:
78
78
  homepage_uri: https://github.com/MUmarShahbaz/jekyll_dynamic_assets
79
79
  source_code_uri: https://github.com/MUmarShahbaz/jekyll_dynamic_assets
80
80
  changelog_uri: https://github.com/MUmarShahbaz/jekyll_dynamic_assets/blob/main/CHANGELOG.md
81
- post_install_message:
82
81
  rdoc_options: []
83
82
  require_paths:
84
83
  - lib
@@ -93,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
92
  - !ruby/object:Gem::Version
94
93
  version: '0'
95
94
  requirements: []
96
- rubygems_version: 3.5.22
97
- signing_key:
95
+ rubygems_version: 3.6.7
98
96
  specification_version: 4
99
97
  summary: Dynamically include your asset files
100
98
  test_files: []