moshen / jekyll-asset_bundler

A small plugin for Jekyll to easily bundle and compress site assets
MIT License
101 stars 21 forks source link

can't convert Array into String - error #8

Closed berkes closed 11 years ago

berkes commented 11 years ago

Probably a version issue.

When running jekyll with this plugin and a bundle, or bundle_glob-tag, the following error is returned:

Asset Bundler - Error: YAML bundle is not an Array
["\n- /assets/javascripts/*.js\n- /assets/stylesheets/*.css\n"]
Asset Bundler - Error: Problem parsing a YAML bundle
["\n- /assets/javascripts/*.js\n- /assets/stylesheets/*.css\n"]

can't convert Array into String

It seems that BundleTag::render, after calling Super gets an array, not a String.

My versions are: jekyll (0.11.0) liquid (2.2.2) ruby 1.9.3p286 YAML::ENGINE.yamler #=> "psych"

moshen commented 11 years ago

Mac/Linux/Windows?

Could you post the bundle source from your template/html file?

berkes commented 11 years ago

Here is the source with a few lines of context:

   <link rel="author" href="{{ BASE_PATH }}/humans.txt" type="text/plain" />

{% bundle %}
- /assets/javascripts/app.js
- /assets/stylesheets/app.css
{% endbundle %}

   <!-- Included CSS Files -->
   <link rel="stylesheet" href="{{ ASSET_PATH }}/stylesheets/foundation.css">

I have tried changing indentation, tried the one-line version and tried adding a --- to the top of the block.

Machine is Linux, Ubuntu 12.10, RVM used to manage ruby.

moshen commented 11 years ago

It could very well be a version issue. I just checked my version and I'm currently running:

I will put in a check and post a fixed version for you to test.

moshen commented 11 years ago

I found the issue. It is indeed the difference between liquid versions:

In version 2.2.2: render returns an array

In version 2.4.0: render returns a string (by joining the results of the .each call)

I'm pretty sure this was a bugfix on their part, because when you look at the root Tag class here, it returns a string from the render method stub.

I will still put in a check, but you may want to upgrade if you find incompatibilities with other plugins.

berkes commented 11 years ago

Problem with upgrading is that Gihub's Jekyll-parser uses 2.2.2, so upgrading means leaving the github-post-push building and doing it offline.

moshen commented 11 years ago

I'm not sure I understand. GitHub uses the safe option, which means you can't use any custom plugins with GitHub pages and Jekyll.

berkes commented 11 years ago

Ah, I was not even aware of that flag :(. That pulls the moment to start compiling my own drastically forward :)

berkes commented 11 years ago

Upgrading Liquid to 2.4.x indeed works.

moshen commented 11 years ago

Glad to know that it works. Finding out about the "safe" usage led me to writing my own Jekyll plugins. If you have your own host, it's pretty easy to make a git post-receive hook that rebuilds your site for you to replicate the GitHub workflow. I went the other way and have my jekyll site Rakefile build and rsync the results to the remote.