Compress Jekyll website with jekyll-press

To compress your output files (from the _site folder), you can use jekyll-press.

It’s very easy to install, configure and enable.

Install g++

Install build-essential and g++:

sudo apt-get install build-essential g++

Install the bundler gem

sudo gem install bundler

Install jekyll-press

In the root folder of your Jekyll instance, create a file Gemfile, and add this:

source 'https://rubygems.org'

gem 'jekyll'
gem 'execjs'
gem 'therubyracer'
gem 'jekyll-press'

Then execute:

$ bundle

Enable jekyll-press

Create the following plugin in your project’s _plugins directory.

# _plugins/bundler.rb
require "rubygems"
require "bundler/setup"
Bundler.require(:default)

This will automatically require all of the gems specified in your Gemfile.

Configure jekyll-press

In your _congif.yml file, add this block:

jekyll-press:
  exclude: 'atom.xml' # Exclude files from processing - file name, glob pattern or array of file names and glob patterns
  js_options: {}      # js minifier options
  css_options: {}     # css minifier options
  html_options: {}    # html minifier options

Enjoy

Next time you rebuild your website, the output files will be compressed.

No tips yet.
Be the first to tip!

Like this post? Tip me with bitcoin!

1JiD6uDNt6ERtdwu1g2UA6zLzcAb8DHhPw

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Leave a Reply

Your email address will not be published. Required fields are marked *