koa-modules / swig

Koa view render based on Swig, support tags, filters, and extensions
MIT License
30 stars 12 forks source link

allow for using `swig.render` instead of `swig.renderFile` #10

Closed soggie closed 9 years ago

soggie commented 9 years ago

This might sound like a weird request, but do you think if it is possible to allow an option to render with swig.render instead of swig.renderFile in https://github.com/koa-modules/koa-swig/blob/master/index.js#L43?

I'm asking because I have a middleware that needs to dynamically detect a bunch of files and possibly concat them depending on the context, and most of the time I end up with the raw HTML instead of a file for swig to render. Adding this allows me to pass in the raw HTML into render() instead of expecting it to read from a file, which makes my life 1000% easier.

I can submit a pull request later tonight if you guys are fine with it.

haoxins commented 9 years ago

I see. welcome.

fundon commented 9 years ago

@soggie welcome

fundon commented 9 years ago

Closed. You can reopen if you need.