How to use the jsrender.compile function in jsrender

To help you get started, we’ve selected a few jsrender examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BorisMoore / jsviews.com / test / unit-tests / tests-node.js View on Github external
QUnit.test("jsrender.tags.clientTemplate", function(assert) {
	jsrender.views.settings.delimiters("<%", "%>");
	var tmpl = jsrender.compile(
		'\n'
		+ '\n'
		+ '<%clientTemplate "./test/templates/outer.html"/%>\n'
		+ '<%clientTemplate "./test/templates/inner.html"/%>\n'
		+ '\n'
		+ '<div id="result"></div>\n'
		+ '');
	var html = tmpl({name: "Jo"});
	assert.equal(html,
		'\n'
		+ '\n'
		+ '\n'
		+ '\n'
		+ '\n'
		+ '<div id="result"></div>\n'
		+ '',
github BorisMoore / jsviews.com / test / unit-tests / tests-node.js View on Github external
QUnit.test("jsrender.compile", function(assert) {
	var tmpl = jsrender.compile('./test/templates/name-template.html');
	var html = tmpl({name: "Jo"});
	assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.compile("./file.path.html") compiles template');

	tmpl = jsrender.compile('Some {{:~upper("Markup")}} Name: {{:~upper(name)}} {{lower:name}}', {helpers: {upper:upper}, converters: {lower:lower}});
	html = tmpl({name: "Jo"});
	assert.equal(html, "Some MARKUP Name: JO jo", 'jsrender.compile("markup", {helpers: ..., ...}) compiles template with options');
});
github BorisMoore / jsviews.com / test / unit-tests / tests-node.js View on Github external
QUnit.test("jsrender.compile", function(assert) {
	var tmpl = jsrender.compile('./test/templates/name-template.html');
	var html = tmpl({name: "Jo"});
	assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.compile("./file.path.html") compiles template');

	tmpl = jsrender.compile('Some {{:~upper("Markup")}} Name: {{:~upper(name)}} {{lower:name}}', {helpers: {upper:upper}, converters: {lower:lower}});
	html = tmpl({name: "Jo"});
	assert.equal(html, "Some MARKUP Name: JO jo", 'jsrender.compile("markup", {helpers: ..., ...}) compiles template with options');
});

jsrender

Best-of-breed templating in browser or on Node.js (with Express 4, Hapi and Browserify integration)

MIT
Latest version published 4 months ago

Package Health Score

70 / 100
Full package analysis