Closed wejendorp closed 11 years ago
hey cool idea. ideally the plugin could either be invoked options, or just passed in like normal. for an example of how i've done this in the past, see https://github.com/segmentio/model-defaults/blob/master/index.js – you can then do just .use(jade)
or .use(jade({ html: true }))
should probably bump the version to 0.4.0
. but luckily that should mean no breaking changes - im assuming the functions backwards compat is only if you turn on the html
option yeah?
can you call the option just html
and can you pull all the string escaping logic into one helper named escapeHtml
or whatever best describes it
Nice way to wrap it, I will use that. Sounds good, on it. And yea, it is fully backwards compatible if you dont use the flag.
But they are both objects here, can't really use typeof to distinguish between an options object and a builder instance. You know another way?
How about making it a configuration step instead: jade.set({html: true})
before passing it to builder?
might be able to check if the builder instanceof Builder
dunno how circular deps work in node — or jankier, check for a known property on the builder
.
I just check for the Builder.build
method, that shouldn't be going anywhere. Now it's backwards compatible.
Sorry for the commit spam.
:+1:
thanks for this, just cleaned up a bit, let me know if you run into anything else
Nice cleanup.
However, escapeHtml
function is broken now, remove the first quote line and move it to the end:
string = '\'' + string + '\'';
ah shoot yup, check again
Allows component-jade to transparently use jade files as component html -> js templates.
Breaking changes: The middleware is now wrapped in a configuration function.
The jade includes are no longer functions.
Dependencies: Updates jade version for fix of
jade.render
.