Closed ForbesLindesay closed 8 years ago
There aren't much docs for .compileClient, so I'm not quite sure what it accomplishes. Does it mimic that of Jade's http://jade-lang.com/api/ ? The .compile() implementation, returned as a string that can be used on the client side?
Know if test-transformer has support for it? For everything client-side, I've been using Browserify.
It's intended to allow us to write a browserify transform that replaces code like:
var fnt = require('jstransformer')(require('jstransformer-function'));
var fn = fnt.compile('return "Hello" + this.name');
with:
var fn = function (locals) { return function () { return "Hello" + this.name }.call(this) };
Unfortunately, the output format isn't very standardised yet, so we need to think about what this should be. A few questions to answer:
We should answer those questions and then build tests for them. We don't really need to actually test in real browsers. compileClient
really just means, compileToJavaScriptString
, but client is a bit snappier and is the only real use case I can think of.
This needs testing, I haven't actually tried running this.