Jekyll::Turbo
jekyll-turbo is a simple Jekyll plugin that brings Hotwire Turbo Drive to your static site. It automatically injects the necessary <script type="module">
tag into your HTML files at build time.
Installation
-
Add the following to your site's
Gemfile
:gem 'jekyll-turbo'
-
Add the following to your site's
_config.yml
:plugins: - jekyll-turbo
Note: if
jekyll --version
is less than3.5
use:gems: - jekyll-turbo
-
In your terminal, execute:
bundle
-
(re)start your Jekyll server with:
jekyll serve
Usage
Install the plugin as described above.
The plugin will automatically inject this tag into the <head>
of all your generated .html
pages:
<script type="module" src="https://cdn.jsdelivr.net/npm/@hotwired/turbo@8.0.4/dist/turbo.es2017-esm.js"></script>
Then, you can immediately use all Hotwire Turbo features on the client side, such as Turbo Drive and Turbo Frames.
⚠️ Tip: Note that the github-pages
gem runs in safe
mode and only allows a defined set of plugins. To use this gem in GitHub Pages, you need to build your site locally or use a CI (e.g. Github Workflow).
Click here for more information.
Planned Features
This plugin is currently zero-config and focused on simplicity. Future improvements may include:
- Option to serve Turbo locally instead of using a CDN
- Support for customizing the Turbo version
- Configuration via
_config.yml
Feel free to open an issue or contribute via pull request if you'd like to help!
Contributing
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.
- Fork this repository
- Create your branch (
git checkout -b feat/my-new-feature
) - Commit your changes (
git commit -m 'Add cool feature'
) - Push to the branch (git push origin feat/my-new-feature)
- Create a new Pull Request
Development
To install this gem onto your local machine, run bundle exec rake install
.
Testing
Use the following command to run tests and RuboCop check:
rake
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Jekyll::Turbo project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.