4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/middleman-smusher/extension.rb', line 4
def registered(app, options={})
require "smusher"
options[:quiet] = true
app.after_configuration do
smush_dir = if options.has_key?(:path)
options.delete(:path)
else
File.join(build_dir, images_dir)
end
prefix = build_dir + File::SEPARATOR
after_build do |builder|
files = ::Smusher.class_eval do
images_in_folder(smush_dir)
end
files.each do |file|
::Smusher.optimize_image(
[file],
options
)
builder.say_status :smushed, file.sub(prefix, "")
end
end
end
end
|