A Jekyll plugin for integrating imgix
Switch branches/tags
Clone or download
hashknot Merge pull request #10
Move to BSD-2-Clause license
Latest commit 4b51272 Jun 19, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib/jekyll
spec
.gitignore
.rspec
.travis.yml
Gemfile
LICENSE
README.md
Rakefile
jekyll-imgix.gemspec

README.md

jekyll-imgix Travis Build Status

A simple Jekyll plugin for rolling imgix functionality into your Jekyll site.

Installation

First, add liquid and jekyll-imgix to the :jekyll_plugins group in your Gemfile:

group :jekyll_plugins do
  gem 'rouge'
  gem 'kramdown'
  gem 'liquid'
  gem 'jekyll-imgix'
end

Then include jekyll-imgix in the gems: section of your _config.yml file:

gems: [jekyll/imgix]

Usage

jekyll-imgix does not do anything unless JEKYLL_ENV is set to production. For example, you will want to run JEKYLL_ENV=production jekyll build before deploying your site to production.

jekyll-imgix exposes its functionality as a single Jekyll Filter, imgix_url.

Simply pass an existing image path to it to activate it:

<img src={{ "/images/bear.jpg" | imgix_url }} />

That will generate the following HTML in your output:

<img src="https://assets.imgix.net/images/bear.jpg" />

You can also pass parameters to the imgix_url helper like so:

<img src={{ "/images/bear.jpg" | imgix_url: w: 400, h: 300 }} />

Which would result in the following HTML:

<img src="https://assets.imgix.net/images/bear.jpg?w=400&h=300" />

Configuration

jekyll-imgix requires a configuration block in your _config.yml:

imgix:
  source: assets.imgix.net # Your imgix source address
  secure_url_token: FACEBEEF12 # (optional) The Secure URL Token associated with your source

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/imgix/jekyll-imgix.

License

The gem is available as open source under the terms of the BSD-2-Clause License.