Skip to content

Commit 5f46511

Browse files
committed
Better support Node.js style module loaders.
1 parent 6524a05 commit 5f46511

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-11
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
[JavaScript Templates Demo](https://blueimp.github.io/JavaScript-Templates/)
55

66
## Description
7-
< 1KB lightweight, fast & powerful JavaScript templating engine with zero
8-
dependencies. Compatible with server-side environments like node.js, module
9-
loaders like RequireJS and all web browsers.
7+
1KB lightweight, fast & powerful JavaScript templating engine with zero
8+
dependencies. Compatible with server-side environments like Node.js, module
9+
loaders like RequireJS, Browserify or webpack and all web browsers.
1010

1111
## Usage
1212

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
<![endif]-->
1919
<meta charset="utf-8">
2020
<title>JavaScript Templates Demo</title>
21-
<meta name="description" content="&lt; 1KB lightweight, fast &amp; powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.">
21+
<meta name="description" content="1KB lightweight, fast &amp; powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like Node.js, module loaders like RequireJS, Browserify or webpack and all web browsers.">
2222
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2323
<link rel="stylesheet" href="css/demo.css">
2424
</head>
2525
<body>
2626
<h1>JavaScript Templates Demo</h1>
27-
<p><strong>&lt; 1KB</strong> lightweight, fast &amp; powerful <a href="https://developer.mozilla.org/en/JavaScript/">JavaScript</a> templating engine with zero dependencies.<br>
28-
Compatible with server-side environments like <a href="http://nodejs.org/">node.js</a>, module loaders like <a href="http://requirejs.org/">RequireJS</a> and all web browsers.</p>
27+
<p><strong>1KB</strong> lightweight, fast &amp; powerful <a href="https://developer.mozilla.org/en/JavaScript/">JavaScript</a> templating engine with zero dependencies.<br>
28+
Compatible with server-side environments like <a href="http://nodejs.org/">Node.js</a>, module loaders like <a href="http://requirejs.org/">RequireJS</a>, <a href="http://browserify.org/">Browserify</a> or <a href="https://webpack.github.io/">webpack</a> and all web browsers.</p>
2929
<ul class="navigation">
3030
<li><a href="https://github.com/blueimp/JavaScript-Templates/tags">Download</a></li>
3131
<li><a href="https://github.com/blueimp/JavaScript-Templates">Source Code</a></li>

js/runtime.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* http://www.opensource.org/licenses/MIT
1010
*/
1111

12-
/*global define */
12+
/*global define, module */
1313

1414
(function ($) {
1515
"use strict";
@@ -41,6 +41,8 @@
4141
define(function () {
4242
return tmpl;
4343
});
44+
} else if (typeof module === "object" && module.exports) {
45+
module.exports = tmpl;
4446
} else {
4547
$.tmpl = tmpl;
4648
}

js/tmpl.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
/*jshint evil: true */
16-
/*global document, define */
16+
/*global document, define, module */
1717

1818
(function ($) {
1919
"use strict";
@@ -81,6 +81,8 @@
8181
define(function () {
8282
return tmpl;
8383
});
84+
} else if (typeof module === "object" && module.exports) {
85+
module.exports = tmpl;
8486
} else {
8587
$.tmpl = tmpl;
8688
}

js/tmpl.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "blueimp-tmpl",
33
"version": "2.5.7",
44
"title": "JavaScript Templates",
5-
"description": "< 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.",
5+
"description": "1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like Node.js, module loaders like RequireJS, Browserify or webpack and all web browsers.",
66
"keywords": [
77
"javascript",
88
"templates",

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,5 +308,5 @@
308308
}(
309309
this,
310310
this.expect || require('expect.js'),
311-
this.tmpl || require('../js/tmpl').tmpl
311+
this.tmpl || require('../js/tmpl')
312312
));

0 commit comments

Comments
 (0)