Sublime Forum

Text Templating in Sublime Text 2?

#1

Greetings.

I am creating a javascript library, of which the classes I would prefer to have in separate files, and, on save/build, compile into a single js file according to a specific template.
What build system should I use in order to get, say, include file-like behaviour?

Contents of myLibrary.template.js

(function (global) {

    <#@ include file="src/MyFactory.class.js" #>
    <#@ include file="src/MyClass.class.js" #>

    global.myClassFactory = new MyFactory(MyClass);

}(this));

Contents of src/MyFactory.class.js

var MyFactory = ...]

Contents of src/MyClass.class.js

var MyClass = ...]

Although I have used javascript as an example, this is a language-independent question. What template transformation toolkit could I use, and how would I configure my build system?

0 Likes