Open cowboy opened 10 years ago
Yes, there is definitely a place for it. We were close to settling on a standard across all templating tasks before I disappeared into the woods. The relevant conversation is here: gruntjs/grunt-contrib-handlebars#26
Ok, well it seems like this should happen for grunt-contrib-handlebars and grunt-contrib-jade, but in a consistent way. So let's discuss the solution for all 3 plugins here.
Some questions:
render
that, when set to true, renders the template with the specified data object?/cc @tbranyen @shama @sindresorhus @vladikoff
I'm guessing that if a plugin needed partials, we'd already be specifying some kind of baseDir option. Right?
Unless I am misunderstanding you, a baseDir would be meaningless for jst/handlebars, as they don't have the concept of file io built in like jade does.
/cc @oswaldoacauan @mitsuruog @pspeter3 @tnguyen14 @outaTiME @mehcode pinging a few devs who were interested in this feature and hopefully have some input.
@tkellen correct, but in case we ever added another templating plugin that supported partials, it seemed like a good "standard" option to define.
For example, I see a few options in grunt-contrib-handlebars for dealing with partials, but they seem to be a bit ad-hoc, and confusing to me. Could configuring partials support for grunt-contrib-handlebars and grunt-contrib-jade be done in more general ways?
Something to perhaps reference. We have implemented static compilation / partials in https://github.com/concordusapps/grunt-haml. From a pull request we also have static compilation to JS variables (basically take the HTML and assign them to JS variables in a big file) -- seems a bit weird to me but I don't use server-side templates too much.
If anything, I'll make sure to watch this space and update the plugin to conform to whatever is decided.
There are 2 main use-cases I see for "javascript" templates:
This plugin already does 1, but what about 2? In my example, I'm already using lo-dash templates in the client via requirejs plugin, but I don't want to use Jade for the app's index.html page. I also want to use lo-dash templates.
So, in my project Gruntfile, I created this "tmpl" task, but it seems a little redundant for this to be a separate thing.
Is there a place in grunt-contrib-jst for the "2" behavior?