https://github.com/nidi3/jekyll-image_optimizer
A jekyll plugin to optimize images for the web
https://github.com/nidi3/jekyll-image_optimizer
jekyll-plugin optimize-images ruby
Last synced: about 2 months ago
JSON representation
A jekyll plugin to optimize images for the web
- Host: GitHub
- URL: https://github.com/nidi3/jekyll-image_optimizer
- Owner: nidi3
- License: apache-2.0
- Created: 2015-01-09T22:29:21.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-08T17:47:02.000Z (over 9 years ago)
- Last Synced: 2025-04-25T17:59:12.842Z (2 months ago)
- Topics: jekyll-plugin, optimize-images, ruby
- Language: Ruby
- Size: 11.7 KB
- Stars: 15
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jekyll-image_optimizer
A jekyll plugin to optimize images for the web.
It reads all the images in a source directory and saves optimized versions of them to a destination directory
and creates a symbolic link to the destination directory.Install it with `gem install jekyll-image_optimizer`.
Add this to your `plugins/ext.rb` file: `require 'jekyll/image_optimizer'`.
The following options for `_config.yml` are available:
Option | Description | Default value
--- | --- | ---
`raw_images` | the directory containing the unoptimized images | `img/raw`
`opt_images` | the directory containing the optimized images | `img/opt`
`images_link` | the name of the symbolic link pointing to `opt_images` | `images`
`image_geometry` | the size all images should be, is an ImageMagick [geometry string](http://www.imagemagick.org/RMagick/doc/imusage.html#geometry) and may be an array | `800x800>`
`image_hash` | if the optimized image files should be appended with a hash to enable unlimited caching | `true`
`image_layout` | the file containing the template for the `image` tag (inside `_layouts` folder) | `image.html`The plugin defines two liquid tags: `srcset` and `image`.
To include an image with multiple resolutions (using [scrset](http://ericportis.com/posts/2014/srcset-sizes/)) into a post, do the following:In `_layouts/image.html` define the template of an image. For example:
```![]()
```In the front matter of the post, add
```
image:
- url: my_image.jpg
alt: My Alt
layout: my-image.html
```and reference the image using `{% image 0 %}` where 0 is the index of the image.
The optional `layout` parameter overwrites the `image_layout` parameter in `_config.yml`.