rbuchberger / jekyll_picture_tag

Easy responsive images for Jekyll.
https://rbuchberger.github.io/jekyll_picture_tag/
BSD 3-Clause "New" or "Revised" License
622 stars 106 forks source link

Build error #62

Closed rampatra closed 9 years ago

rampatra commented 9 years ago

My _config.yaml

# PLUGINS
gems: [jekyll-picture-tag]

# JEKYLL PICTURE TAG SETTINGS
picture:
  source: "img/posts"

Usage

{% picture IS-A.png %}

Error

Liquid Exception: undefined method `[]' for nil:NilClass in _posts/2015-05-25-object-oriented-design.md
/Library/Ruby/Gems/2.0.0/gems/jekyll-picture-tag-0.2.3/lib/jekyll-picture-tag.rb:43:in `render': undefined method `[]' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/2.0.0/gems/liquid-2.6.2/lib/liquid/block.rb:109:in `block in render_all'
    from /Library/Ruby/Gems/2.0.0/gems/liquid-2.6.2/lib/liquid/block.rb:96:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/liquid-2.6.2/lib/liquid/block.rb:96:in `render_all'
    from /Library/Ruby/Gems/2.0.0/gems/liquid-2.6.2/lib/liquid/block.rb:82:in `render'
    from /Library/Ruby/Gems/2.0.0/gems/liquid-2.6.2/lib/liquid/template.rb:128:in `render'
    from /Library/Ruby/Gems/2.0.0/gems/liquid-2.6.2/lib/liquid/template.rb:138:in `render!'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/convertible.rb:106:in `render_liquid'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/convertible.rb:233:in `do_layout'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/post.rb:261:in `render'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:298:in `block in render'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:297:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:297:in `render'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:51:in `process'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/command.rb:28:in `process_site'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/commands/build.rb:56:in `build'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/commands/build.rb:34:in `process'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/bin/jekyll:20:in `<top (required)>'
    from /usr/bin/jekyll:23:in `load'
    from /usr/bin/jekyll:23:in `<main>'

Can anyone please correct me where I am wrong?

P.S: A proper example would be of great help as I am not a Ruby developer.

btobolaski commented 9 years ago

You appear to be missing the preset settings. You should have something like this in your _config.yml

picture:
  source: "img/posts"
  presets: 
    default:
      ppi: [1, 1.5, 2]
      source_large:
        media: "(min-width: 480px)"
        width: "252"
      source_default:
        width: "480"