Class: AsyncImage

Inherits:
Middleman::Extension
  • Object
show all
Defined in:
lib/middleman-async-image/extension.rb

Overview

Extension namespace

Instance Method Summary collapse

Constructor Details

#initialize(app, options_hash = {}, &block) ⇒ AsyncImage

Returns a new instance of AsyncImage.



15
16
17
18
19
20
21
# File 'lib/middleman-async-image/extension.rb', line 15

def initialize(app, options_hash={}, &block)
  # Call super to build options from the options_hash
  super

  # set up your extension
  # puts options.my_option
end

Instance Method Details

#after_configurationObject



30
31
32
33
# File 'lib/middleman-async-image/extension.rb', line 30

def after_configuration
  compress_dir
  puts "Async loaded images will be compress from source/" + app.config[:images_dir] + " to source/#{app.config[:images_dir]}/" + options.compress_image_path
end

#compress_dirObject



23
24
25
26
27
28
# File 'lib/middleman-async-image/extension.rb', line 23

def compress_dir
  dir = "source/#{app.config[:images_dir]}/" + options.compress_image_path
  unless Dir.exists?(dir)
    FileUtils.mkdir(dir)
  end
end