jekyll-turbo 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f8a3adb518ea5e07065d2d63003f9bae7f3c629ffd24090732a3c8d32b2e6f4d
4
+ data.tar.gz: 0b52a99ffbda14ef0598d2f88416ca9dad8ccecbcb103b28d431830c8dd949c4
5
+ SHA512:
6
+ metadata.gz: b12dd0620e655d9bce0111a617aee570e1906f4e6772030480cba8c37bbf2a808e402ed8cb5dab4d8fb8b81036c1c7551b1a9f2f17016dd3e1d9c7e4844edc11
7
+ data.tar.gz: 74c6d9e3403c5f952e9bd8fda0407f8f19bf4c8a9ad90da7689007c598cdb35155194c13fcbb503d8600ade7ae11bf895f82ef8e10d57d9fbaf49329103ec246
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+
6
+ Style/StringLiterals:
7
+ EnforcedStyle: double_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ EnforcedStyle: double_quotes
11
+
12
+ Naming/FileName:
13
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-05-02
4
+
5
+ - Initial release
@@ -0,0 +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
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 maikhel
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 ADDED
@@ -0,0 +1,92 @@
1
+ # Jekyll::Turbo
2
+
3
+ [![Build Status](https://github.com/maikhel/jekyll-turbo/actions/workflows/main.yml/badge.svg)](https://github.com/maikhel/jekyll-turbo/actions)
4
+
5
+ **jekyll-turbo** is a simple Jekyll plugin that brings [Hotwire Turbo Drive](https://turbo.hotwired.dev/) to your static site. It automatically injects the necessary `<script type="module">` tag into your HTML files at build time.
6
+
7
+ ## Installation
8
+
9
+ 1. Add the following to your site's `Gemfile`:
10
+
11
+ ```ruby
12
+ gem 'jekyll-turbo'
13
+ ```
14
+
15
+ 2. Add the following to your site's `_config.yml`:
16
+
17
+ ```yml
18
+ plugins:
19
+ - jekyll-turbo
20
+ ```
21
+
22
+ **Note**: if `jekyll --version` is less than `3.5` use:
23
+
24
+ ```yml
25
+ gems:
26
+ - jekyll-turbo
27
+ ```
28
+
29
+ 3. In your terminal, execute:
30
+
31
+ ```bash
32
+ bundle
33
+ ```
34
+
35
+ 4. (re)start your Jekyll server with:
36
+
37
+ ```bash
38
+ jekyll serve
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ Install the plugin as described above.
44
+ The plugin will automatically inject this tag into the `<head>` of all your generated `.html` pages:
45
+
46
+ ```HTML
47
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@hotwired/turbo@8.0.4/dist/turbo.es2017-esm.js"></script>
48
+ ```
49
+ Then, you can immediately use all Hotwire Turbo features on the client side, such as Turbo Drive and Turbo Frames.
50
+
51
+ **⚠️ Tip:** Note that the `github-pages` gem runs in `safe` mode and only allows [a defined set of plugins](https://pages.github.com/versions/). To use this gem in GitHub Pages, you need to build your site locally or use a CI (e.g. [Github Workflow](https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow)).
52
+
53
+ [Click here for more information.](https://jekyllrb.com/docs/continuous-integration/github-actions/)
54
+
55
+ ## Planned Features
56
+ This plugin is currently zero-config and focused on simplicity. Future improvements may include:
57
+
58
+ - [ ] Option to serve Turbo locally instead of using a CDN
59
+ - [ ] Support for customizing the Turbo version
60
+ - [ ] Configuration via `_config.yml`
61
+
62
+ Feel free to open an issue or contribute via pull request if you'd like to help!
63
+
64
+ ## Contributing
65
+
66
+ Bug reports and pull requests are welcome on GitHub at https://github.com/maikhel/jekyll-turbo. 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/maikhel/jekyll-turbo/blob/main/CODE_OF_CONDUCT.md).
67
+
68
+ 1. [Fork this repository](https://github.com/maikhel/jekyll-turbo/fork)
69
+ 2. Create your branch (`git checkout -b feat/my-new-feature`)
70
+ 3. Commit your changes (`git commit -m 'Add cool feature'`)
71
+ 4. Push to the branch (git push origin feat/my-new-feature)
72
+ 5. Create a new Pull Request
73
+
74
+ ### Development
75
+
76
+ To install this gem onto your local machine, run `bundle exec rake install`.
77
+
78
+ ### Testing
79
+
80
+ Use the following command to run tests and RuboCop check:
81
+
82
+ ```bash
83
+ rake
84
+ ```
85
+
86
+ ## License
87
+
88
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
89
+
90
+ ## Code of Conduct
91
+
92
+ Everyone interacting in the Jekyll::Turbo project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/maikhel/jekyll-turbo/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[test rubocop]
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Turbo
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+
5
+ module Jekyll
6
+ module Turbo
7
+ # Jekyll::Turbo::Injector is a Jekyll plugin that injects a <script> tag
8
+ # for Hotwire Turbo into the HTML <head> of each generated page.
9
+ #
10
+ # It enables Turbo Drive functionality in static Jekyll sites by automatically
11
+ # including the Turbo JavaScript via CDN.
12
+ #
13
+ # This class is designed to be used as part of the jekyll-turbo gem.
14
+ #
15
+ # Usage:
16
+ # - Add `jekyll-turbo` to your Gemfile and `_config.yml` plugins list
17
+ class Injector
18
+ CDN_URL = "https://cdn.jsdelivr.net/npm/@hotwired/turbo@8.0.4/dist/turbo.es2017-esm.js"
19
+
20
+ def self.add_script(page)
21
+ return unless page.output_ext == ".html" && page.output.include?("</head>")
22
+
23
+ turbo_script = <<~HTML
24
+ <script type="module" src="#{CDN_URL}"></script>
25
+ HTML
26
+
27
+ # Inject the Turbo script just before </head>
28
+ page.output = page.output.sub("</head>", "#{turbo_script}\n</head>")
29
+ end
30
+
31
+ # Hook into the post_render step for each page
32
+ Jekyll::Hooks.register :pages, :post_render do |page|
33
+ Jekyll::Turbo::Injector.add_script(page)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll/turbo/version"
4
+ require "jekyll/turbo"
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-turbo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - maikhel
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-05-05 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: jekyll
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '3.7'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '5.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '3.7'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '5.0'
32
+ description: jekyll-turbo is a plugin for Jekyll that seamlessly integrates Hotwire's
33
+ Turbo Drive into your static site. It automatically injects the necessary script
34
+ tag into your HTML output to enable client-side Turbo features, such as Turbo Drive
35
+ and Turbo Frames.
36
+ email:
37
+ - mlecicki@gmail.com
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - ".rubocop.yml"
43
+ - CHANGELOG.md
44
+ - CODE_OF_CONDUCT.md
45
+ - LICENSE.txt
46
+ - README.md
47
+ - Rakefile
48
+ - lib/jekyll-turbo.rb
49
+ - lib/jekyll/turbo.rb
50
+ - lib/jekyll/turbo/version.rb
51
+ homepage: https://github.com/maikhel/jekyll-turbo/
52
+ licenses:
53
+ - MIT
54
+ metadata:
55
+ homepage_uri: https://github.com/maikhel/jekyll-turbo/
56
+ source_code_uri: https://github.com/maikhel/jekyll-turbo/
57
+ changelog_uri: https://github.com/maikhel/jekyll-turbo/blob/main/CHANGELOG.md
58
+ bug_tracker_uri: https://github.com/maikhel/jekyll-turbo/issues
59
+ documentation_uri: https://github.com/maikhel/jekyll-turbo#readme
60
+ rubygems_mfa_required: 'true'
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 3.1.0
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubygems_version: 3.6.2
76
+ specification_version: 4
77
+ summary: A Jekyll plugin that automatically injects Turbo Drive to enable faster,client-side
78
+ page transitions.
79
+ test_files: []