Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support jade.compileFile #12

Open
ForbesLindesay opened this issue Jul 22, 2014 · 4 comments
Open

Support jade.compileFile #12

ForbesLindesay opened this issue Jul 22, 2014 · 4 comments

Comments

@ForbesLindesay
Copy link

I'm planning to land a new API in jade (pugjs/pug#1596) that I think could be really awesome for browserify. It would allow us to support something like:

var jade = require('jade');
var template = jade.compileFile(__dirname + "/template.jade");

document.getElementById("my-thing").innerHTML = template({
    localVar: "value",
    anotherOne: "another value"
});

The benefit of this would be that it is much closer to the sort of code that you'd expect to see on the server side. It would even allow many modules to share client side and server side code while doing jade rendering.

Would you consider supporting this?

@ForbesLindesay
Copy link
Author

Oh, and I forgot to mention, we can do options as well:

var jade = require('jade');
var template = jade.compileFile(__dirname + "/template.jade", {pretty: true});

document.getElementById("my-thing").innerHTML = template({
    localVar: "value",
    anotherOne: "another value"
});

@domenic
Copy link
Owner

domenic commented Jul 22, 2014

Yeah, for sure, as long as it doesn't change the Jadeify user experience.

@kahboom
Copy link

kahboom commented Aug 28, 2015

@domenic - I would definitely use this feature; I'm compiling templates server-side using something similar to @ForbesLindesay 's example and jadeify to compile partial templates on the client (I'm also using browserify), but if I could share the server-side and client-side code by using Jadeify, it would be very useful.

@a7madgamal
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants