Run Zopfli on middleman after build

72 views Asked by At

We have a Middleman setup, and after is finishes parsing our assets, we want it to compress them using Zopfli. We have tried adding a Node post-process, using the app.after_build hook, but when we run it, we get a 'run node-zopfli from "."' This is the code we have right now:

class MyCmd < Middleman::Extension
  def initialize(app, options_hash={}, &block)
    super
    app.after_build do |builder|
      builder.run 'node-zopfli';
    end
  end
end

::Middleman::Extensions.register(:my_cmd, MyCmd)
activate :my_cmd

We've tried looking for this error, or more information about using Zopfli, to no avail. Can someboddy help us get this right? Thanks.

0

There are 0 answers