Closed mahemoff closed 13 years ago
ah that is a bug due to implicit block scope. i think i will remove it as its more trouble than its worth. im away for the next week. but i wil fix upon my return. you shold be able to do it yourself byremoving block_scope from the default directive in the main include file. cheers
On Wednesday, July 20, 2011, mahemoff reply@reply.github.com wrote:
I tried the following in Express:
var kaffeine = new (require("kaffeine"))(); app.register('.k', { compile: function(str, options) { return function(locals) { return kaffeine.compile(str) }; } }); app.get('/:script.js', function(req, res) { res.header('Content-Type', 'text/plain'); res.render(req.params.script+".k", { layout: false }); });
but I get bad output, e.g. source:
$( () { $("input").attr("id", () { @name; }); });
converts to: $( ()(function() { return $("input").attr("id", ()(function() { return this.name; }).call(this)); }).call(this));
[the version in index.js is 0.0.6]
Reply to this email directly or view it on GitHub: https://github.com/weepy/kaffeine/issues/37
Thanks, i'll let you know once I've tried that.
Hi - I pushed a new version without block scope.
By the way the documentation is out of date (sorry) -- functions are now written with an arrow syntax, so your example should look like :
$ -> { $("input").attr "id", -> @name }
On Wed, Jul 20, 2011 at 6:39 PM, mahemoff < reply@reply.github.com>wrote:
Thanks, i'll let you know once I've tried that.
Reply to this email directly or view it on GitHub: https://github.com/weepy/kaffeine/issues/37#issuecomment-1617277
Working great, thanks.
I tried the following in Express:
var kaffeine = new (require("kaffeine"))(); app.register('.k', { compile: function(str, options) { return function(locals) { return kaffeine.compile(str) }; } }); app.get('/:script.js', function(req, res) { res.header('Content-Type', 'text/plain'); res.render(req.params.script+".k", { layout: false }); });
but I get bad output, e.g. source:
$( () { $("input").attr("id", () { @name; }); });
converts to: $( ()(function() { return $("input").attr("id", ()(function() { return this.name; }).call(this)); }).call(this));
[the version in index.js is 0.0.6]