:each blah in collection = fail #52

Open
kirkbushell opened this Issue Nov 30, 2011 · 2 comments

Projects

None yet

2 participants

@kirkbushell

I am currently using haml.js on the client side, as the templating solution for sammy - and a core aspect of it simply isn't working.

When I do :each var in collection, and then try and use var, it always comes up undefined. Always.

@ilich
ilich commented Dec 5, 2011

I think the issue might be related to a couple of fixes I had done. They are not in the master branch yet.

You can try it - https://github.com/ilich/haml-js

I also did a test. It seems to be OK.

HAML markup:

%html
%body
:each value in collection
%div&= value

JavaScript:

var fs = require("fs"),
Haml = require("./haml-js/lib/haml.js"),
collection = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

var content = fs.readFileSync("./test.haml", "UTF-8");
var html = Haml.render(content, { locals: {
collection: collection
}});

console.log(html);

Please, attach you HAML markup in case you still have the issue.

@kirkbushell

Good to know this has been fixed - unfortunately a tad too late for us to use it in the project (which is a real shame :(). Keep up the good work mate, hopefully we can use it in our next js project :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment