ashmaroli / jekyll-data

A plugin to read '_config.yml' and data files within Jekyll theme gems
MIT License
43 stars 11 forks source link

Liquid Exception: undefined method `to_liquid' #28

Closed shankarho closed 6 years ago

shankarho commented 6 years ago

Jekyll version - 3.7.3

custom theme configured in _config.xml theme: jekyll-theme

I have been building the project without issues but when i add jekyll-data plugin (in Gemfile and plugins section on _config) and build, I see the following error

Liquid Exception: undefined method to_liquid for #<Jekyll::Theme:0x007fd2e18e3cb0> in assets/css/styles.cs

ashmaroli commented 6 years ago

Hi @shankarho :wave: First of all, thank you very much for trying this plugin. Apologies, if this plugin is indeed the cause. This is quite unexpected.

Please post the entire trace output from running bundle exec jekyll build --trace to help me debug the situation.

shankarho commented 6 years ago

Hi @ashmaroli

Thanks for the quick response and support. Please find stack trace below. If I remove the plugin, i don't get this error and the site builds fine. Please let me know if you want me to try out few other things.

 Incremental build: disabled. Enable with --incremental
      Generating... 
  Liquid Exception: undefined method `to_liquid' for #<Jekyll::Theme:0x007fe8fb989a18> in assets/css/styles.css
bundler: failed to load command: jekyll (/usr/local/bin/jekyll)
NoMethodError: undefined method `to_liquid' for #<Jekyll::Theme:0x007fe8fb989a18>
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/variable_lookup.rb:49:in `block in evaluate'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/variable_lookup.rb:38:in `each_index'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/variable_lookup.rb:38:in `evaluate'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/context.rb:159:in `evaluate'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/variable.rb:76:in `render'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/block_body.rb:109:in `render_node'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/block_body.rb:88:in `block in render'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/block_body.rb:75:in `each'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/block_body.rb:75:in `render'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/template.rb:208:in `block in render'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/template.rb:242:in `with_profiling'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/template.rb:207:in `render'
  /Library/Ruby/Gems/2.3.0/gems/liquid-4.0.0/lib/liquid/template.rb:220:in `render!'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/liquid_renderer/file.rb:30:in `block (2 levels) in render!'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/liquid_renderer/file.rb:42:in `measure_bytes'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/liquid_renderer/file.rb:29:in `block in render!'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/liquid_renderer/file.rb:49:in `measure_time'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/liquid_renderer/file.rb:28:in `render!'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/renderer.rb:123:in `render_liquid'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/renderer.rb:76:in `render_document'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/renderer.rb:62:in `run'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:473:in `block in render_pages'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:471:in `each'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:471:in `render_pages'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:191:in `render'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:73:in `process'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/command.rb:28:in `process_site'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/commands/build.rb:65:in `build'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/commands/build.rb:36:in `process'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
  /Library/Ruby/Gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
  /Library/Ruby/Gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
  /Library/Ruby/Gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
  /Library/Ruby/Gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
  /Library/Ruby/Gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
  /Library/Ruby/Gems/2.3.0/gems/jekyll-3.7.3/exe/jekyll:15:in `<top (required)>'
  /usr/local/bin/jekyll:22:in `load'
  /usr/local/bin/jekyll:22:in `<top (required)>'
ashmaroli commented 6 years ago

I do not see a reference to this plugin in the trace output. Therefore, I suggest you provide me with a link to your repository (Or, a minimal, reproducible version that I can test myself)

shankarho commented 6 years ago

Sure, I'll make it a minimal repo and get back.

shankarho commented 6 years ago

I have it here - https://github.com/shankarho/jekyll-issue-debug

ashmaroli commented 6 years ago

@shankarho Thanks for reporting this issue and for the test repository. I have traced the and bug and will come up with a fix in the near future.

If you wish to continue using the plugin in the interim, the workaround is to replace {{ site.theme }} with your theme's name manually.

- @import "{{ site.theme }}"
+ @import "my_theme"