tpl-2-js

2.0.2 • Public • Published

tpl-2-js

A tool which can compile tpl to tpl.js & replace require('xxx.tpl') to require('xxx.tpl.js')

Install

npm install tpl-2-js -g

Usage

tpl-2-js -p <your file dir>

tpl-2-js -p dist/

Example

+dist
 -a.js
 -a.tpl


// a.js
define(function(require, exports, module){
    var view = View.extend({
        template: require('a.tpl')
    });
});
// a.tpl
<h1>I am b</h1>

tpl-2-js -p dist

// a.js
define(function(require, exports, module){
    var view = View.extend({
        template: require('compiled/a.tpl.js')
    });
});

// compiled/a.tpl.js
define(function(require, exports, module){
    module.exports = '<h1>I am b</h1>';
});

Readme

Keywords

none

Package Sidebar

Install

npm i tpl-2-js

Weekly Downloads

1

Version

2.0.2

License

ISC

Last publish

Collaborators

  • freestyle21