Class: AsyncImage
- Inherits:
-
Middleman::Extension
- Object
- Middleman::Extension
- AsyncImage
- Defined in:
- lib/middleman-async-image/extension.rb
Overview
Extension namespace
Instance Method Summary collapse
- #after_configuration ⇒ Object
- #compress_dir ⇒ Object
-
#initialize(app, options_hash = {}, &block) ⇒ AsyncImage
constructor
A new instance of AsyncImage.
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, ={}, &block) # Call super to build options from the options_hash super # set up your extension # puts options.my_option end |
Instance Method Details
#after_configuration ⇒ Object
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]}/" + .compress_image_path end |
#compress_dir ⇒ Object
23 24 25 26 27 28 |
# File 'lib/middleman-async-image/extension.rb', line 23 def compress_dir dir = "source/#{app.config[:images_dir]}/" + .compress_image_path unless Dir.exists?(dir) FileUtils.mkdir(dir) end end |