Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin tommcfarlin/00-public.js Secret
Last active Sep 28, 2017

Embed
What would you like to do?
[JavaScript] The Perfect JavaScript Templating Enging
(function($) {
'use strict';
var _getShop = function() {
var shopHtml =
"<h1>" +
"{{title}}" +
"</h1>";
return shopHtml;
}
$(function() {
var template = new tplite.Template();
var buffer = new tplite.StringBuffer();
var compile = template(_getShop());
compile({
title: 'Hello World!'
}, buffer);
});
})(jQuery);
{
"dependencies": {
"tplite": "1.0.3"
}
}
<?php
wp_enqueue_script(
'tplite-js',
$this->pluginUrl . 'node_modules/tplite/dist/tplite-all.min.js'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.