Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (19 sloc) 657 Bytes

Jekyll Uglify Filter

This Jekyll plugin creates an uglify Liquid Template filter. I use it to minify JavaScript for inlining.

Installation

  1. Add _plugins/uglify.rb to your Jekyll site's _plugins directory
  2. Add this to Jekyll's _config.yml file:
plugins:
  - uglifier
  1. Add gem "uglifier" to your Gemfile
  2. Run bundle install

Usage

The uglify filter runs a string of JavaScript through the Uglifier Gem and returns it. I use it to minify JavaScript for inlining:

{% capture scripts %}
  {% include main.js %}
{% endcapture %}
<script>{{ scripts | uglify | strip }}</script>