On 22 May 2012 16:56, Pierre Guillaume Herveou <
pghe...@gmail.com> wrote:
> Hi there
>
> I created a build tool (
https://github.com/pgherveou/squid) for my projects
> it compiles jade template for you on the fly (as well as coffee and stylus)
> and wrap them inside a requirejs define function with a dependency set on
> jade (this is hardcoded at the moment but I will make this configurable)
This is very close to what I want! Especially the RequireJS wrapping.
Having looked at your code I see that what I've been looking for is
the amdWrap function in
https://github.com/pgherveou/squid/blob/master/src/lib/JadeBuilder.coffee
- ideally this would be integrated into jade itself so that we could
just call
tplFn = jade.compile code, {filename: file, client: true, amdWrap:
'jadeName', compileDebug: false}
where 'jadeName' is the name of the jade runtime (defaults to
'jade-runtime' if the argument is 'true').
I'll ask if that change would be accepted.
> So basically to use my template I just need to do something like that
> var tpl = require('.path/to/my-template')
> , html = tpl({foo:'bar'});
>
> whether you use require-js or not the idea is just to server jade client
> runtime, your compiled template and use the function to render your html
Unfortunately the layout you use for your code and the layout we use
differ :( so I think it would be hard for me to use squid without
significant changes.
But thank you for pointing me at it - reading through it has shown me
how it should be done :)
Cheers,
Edmund.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Express" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/express-js/-/u8Ee3y-LPNAJ.