Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flant/jekyll_include_plugin
Plugin for including contents of local/remote plain text files (or parts of them) into your pages. Allows for multilang comments in the included files.
https://github.com/flant/jekyll_include_plugin
Last synced: 7 days ago
JSON representation
Plugin for including contents of local/remote plain text files (or parts of them) into your pages. Allows for multilang comments in the included files.
- Host: GitHub
- URL: https://github.com/flant/jekyll_include_plugin
- Owner: flant
- License: mit
- Created: 2021-06-18T12:10:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T18:28:24.000Z (about 1 month ago)
- Last Synced: 2024-11-07T20:41:58.478Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 42 KB
- Stars: 13
- Watchers: 7
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-jekyll-plugins - **Jekyll Include** - Plugin for including local/remote file contents (or a part of it) into your pages. (Tags)
README
# Jekyll Include Plugin
Include contents of local/remote plain text files (or parts of them) into your pages.
Allows multilang comments in the included files, which language will be used depends on `{{ page.lang }}`.## Usage
Basic usage as follows:
```jinja
/jekyllroot/pages/foo.md:
-----------------------
lang: en
-----------------------
{% include_file "foo/Dockerfile" snippet="system_deps" syntax="Dockerfile" %}
``````Dockerfile
/jekyllroot/foo/Dockerfile:
--------------------------------------------------------
FROM ruby# []
# [] Install system dependencies
# [] (multiline possible too)
# [] Установка системных зависимостей
RUN apt update && apt install curl -y
# []
```Result:
```Dockerfile
# Install system dependencies
# (multiline possible too)
RUN apt update && apt install curl -y
```Include the local file (path is relative to Jekyll root):
```jinja
{% include_file "Dockerfile" %}
```Include the remote file (only absolute urls):
```jinja
{% include_file "https://raw.githubusercontent.com/werf/werf-guides/master/examples/rails/010_build/Dockerfile" %}
```Include part of the file (the part should be enclosed in `[]` and `[]`):
```jinja
{% include_file "Dockerfile" snippet="snippetname" %}
```Include the file and wrap the result in `` ```dockerfile `` and `` ``` ``:
```jinja
{% include_file "Dockerfile" syntax="dockerfile" %}
```Dynamic parameters:
```jinja
{% include_file "{{ $templatingAllowedHere }}/Dockerfile" snippet="{{ $hereToo }}" %}
```## Installation
Add this line to your application's Gemfile:
```ruby
gem 'jekyll_include_plugin'
```And this into your Jekyll config:
```yaml
plugins:
- jekyll_include_plugin
```Then execute:
```bash
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](https://rubygems.org).
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).