Skip to content

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

Notifications You must be signed in to change notification settings

qubaomingg/tpl-2-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>';
});

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published