Jekyll Include Plugin
Include local/remote file contents (or part of it) into your pages.
Allows multilang comments in the included files, which language will be used depends on {{ page.lang }}.
Usage
Basic usage as follows:
jekyllroot/pages/foo.md:
-----------------------
lang: en
-----------------------
{% include_file "this_dir_is_inside_jekyll_root_dir/foo/Dockerfile" snippet="system_deps" syntax="Dockerfile" %}
this_dir_is_inside_jekyll_root_dir/foo/Dockerfile:
--------------------------------------------------------
FROM ruby
# [<snippet install_system_deps>]
# [<en>] Install system dependencies
# [<en>] (multiline possible too)
# [<ru>] Установка системных зависимостей
RUN apt update && apt install curl -y
# [<endsnippet install_system_deps>]
Result:
# Install system dependencies
# (multiline possible too)
RUN apt update && apt install curl -y
Include whole file:
{% include_file "Dockerfile" %}
Include remote file:
{% include_file "https://raw.githubusercontent.com/werf/werf-guides/master/examples/rails/010_build/Dockerfile" %}
Dynamic parameters:
{% include_file "{{ $templatingAllowedHere }}" snippet="{{ $hereToo }}" %}
Installation
Add this line to your application's Gemfile:
gem 'jekyll_include_plugin'
And this into your Jekyll config:
plugins:
- jekyll_include_plugin
Then execute:
bundle install
Development
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.
License
The gem is available as open source under the terms of the MIT License.