Skip to content

nowamasa/utc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

utc

A simple underscore.js template compiler.

Build Status

Getting Started

Install the module with: npm install -g utc

Using utc (CLI)

Once you have installed utc type utc --help to see all available options

Options:
    -h, --help              output usage information
    -V, --version           output the version number
    -d, --directory         directory
    -s, --fileSuffix        file suffix
    -f, --functionSuffix    function suffix

Examples

Inside 'templates' folder create a file called 'sampleTemplate.js':

(function () {
    define(function () {
        return {
            getListTemplateStr: function () {
                return this._helper() + ": <%= name %>";
            },
            _helper: function () {
                return "hello";
            }
        };
    });
}).call(this);

run utc -d "templates" -s "Template" -f "Str" and you should have the same file with a new content

(function () {
    define(function () {
        return{
            getListTemplateStr: function (obj) {
                var __p = '';
                var print = function () {
                    __p += Array.prototype.join.call(arguments, '')
                };
                with (obj || {}) {
                    __p += 'hello: ' +
                        ( name ) +
                        '';
                }
                return __p;
            }
        };
    });
}).call(this);

License

Copyright (c) 2012 nowamasa
Licensed under the MIT license.

About

A simple underscore.js template compiler.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published