designxtek / template-bundler

Simple template bundler for TypeScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Given a directory containing *.html files with <script>s of type "text/template", this utility will produce a TypeScript file containing a hash of stringified templates.

Usage:

tb [directoryToCrawl] [outputTypeScriptFile] [moduleName]

e.g.:

Given

/MyDirectory/Foo.template.html

  <script type="text/template" id="foo"><h1>Foo</h1></script>

Running tb /MyDirectory output.ts foo.bar will result in the following file:

output.ts

module foo.bar {
  export var Templates = {
    "foo" : "<h1>Foo</h1>"
  };
}

Notes:

  • <script> tags must have a type of "text/template"
  • In the resulting hash, the key will correspond to the ID of the <script> element.
  • Directories are crawled recursively.

About

Simple template bundler for TypeScript

License:MIT License


Languages

Language:JavaScript 92.2%Language:HTML 4.2%Language:TypeScript 2.9%Language:Batchfile 0.7%