• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 11 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Small images are small! Compress yours during middleman build.

Middleman ImageOptim Extension

Serving big images is for numb-skulls! Compress and optimise your imagery during middleman build by running image_optim over it. Aww yiss!

Build Status Code Climate Gem Version


Installation

Go set up the image_optim external utilities, then;

Middleman < 4.0

gem 'middleman-imageoptim', '~> 0.2.1'

Middleman โ‰ฅ 4.0

gem "middleman-imageoptim", '~> 0.3.0'

Usage

activate :imageoptim

You can also configure the extension in the usual fashion, by passing a block to :activate Below is the default configuration showing all available options;

activate :imageoptim do |options|
  # Use a build manifest to prevent re-compressing images between builds
  options.manifest = true

  # Silence problematic image_optim workers
  options.skip_missing_workers = true

  # Cause image_optim to be in shouty-mode
  options.verbose = false

  # Setting these to true or nil will let options determine them (recommended)
  options.nice = true
  options.threads = true

  # Image extensions to attempt to compress
  options.image_extensions = %w(.png .jpg .gif .svg)

  # Compressor worker options, individual optimisers can be disabled by passing
  # false instead of a hash
  options.advpng    = { :level => 4 }
  options.gifsicle  = { :interlace => false }
  options.jpegoptim = { :strip => ['all'], :max_quality => 100 }
  options.jpegtran  = { :copy_chunks => false, :progressive => true, :jpegrescan => true }
  options.optipng   = { :level => 6, :interlace => false }
  options.pngcrush  = { :chunks => ['alla'], :fix => false, :brute => false }
  options.pngout    = { :copy_chunks => false, :strategy => 0 }
  options.svgo      = {}
end

Changelog

0.3.0
0.2.1
  • Minor bugfix for 3.3.9 support.
0.2.0
  • Big cleanup to codebase.
  • More tests.
  • Caching between builds using a manifest file to skip over already-compressed assets (thanks for your work on this @jagthedrummer).
  • Updates image_optim gem to latest version (0.20.2).
  • Adds dependency on image_optim_pack to ensure that binaries are available.
0.1.4
  • Respect plugin ordering in config.rb (thanks @jeffutter) #8.
0.1.3
  • Fix missing license in gemspec.
0.1.2
  • Minor bugfix.
0.1.1
  • Remove legacy requirement for padrino.
0.1.0
  • Complete refactor and clean-up.
  • Introduced an options class. options now work (lol, yay!), thanks @andrew-aladev for your help there.
  • Change of extension activation name from :image_optim to :imageoptim for consistency with internal naming.

More Repositories

1

inject-loader

๐Ÿ’‰๐Ÿ“ฆ A Webpack loader for injecting code into modules via their dependencies.
JavaScript
484
star
2

middleman-react

Ruby gem for automatically transforming JSX and using React in Middleman.
Ruby
55
star
3

google-mobwrite

Import of the google-mobwrite project
Python
27
star
4

simulacrum

UI Regression Testing in Ruby
Ruby
16
star
5

sunulator

Elixir
3
star
6

dotfiles

Shell
3
star
7

Ballfactory

JavaScript
3
star
8

django.sugar

Django Sugar for MacRabbit Espresso
3
star
9

terraform-provider-wormly

Go
3
star
10

react-canvas-experiments

Example code from โ€œThings I Learned Messing Around with React Canvasโ€ โ€” presented at MelbJS
JavaScript
3
star
11

namespace-loader

A webpack loader that exports modules to a namespace based on filesystem heirarchy
JavaScript
2
star
12

rivet

Lightweight PHP framework.
PHP
2
star
13

jquery.query.js

JavaScript
2
star
14

amaze-pre-commit

Shell
2
star
15

plasticine

Learning all about Git
2
star
16

step-librato-build-metrics

Shell
2
star
17

twig-php-typography

PHP Typography for Twig
PHP
1
star
18

Crema

Python
1
star
19

twig-rivet-url

URL reversal for Twig & rivet
1
star
20

cobracommander-henchman

JavaScript
1
star
21

step-bower-install

A Wercker step for installing Bower components
Shell
1
star
22

nomad-local-dev

1
star
23

terraform-provider-kube

1
star
24

spinnaker-example

HTML
1
star
25

nebula

๐ŸŒ  HTTP aware job runner server application heroku-thingy you can run at your own joint
HTML
1
star
26

knowledge

๐Ÿ’ก ๐Ÿ“–
1
star
27

Inkbox

1
star
28

django-staticgenerator

Clone of Jared Kuolt's staticgenerator
Python
1
star
29

dropship

1
star