TCK

TCK (Template Constructor Kit) is a small, free, BSD-licensed Python library and CLI-script to split an HTML file into building blocks for string based template engines to construct complex web GUIs using a DOM-like approach.

Examples

TCK can be used to split an HTML design file into multiple html files (or JSON entries) to be consumed by a (string-based) template engine. This way, you can show the design file to your customers and upgrade the design whenever you want without having to change the code that interacts with the design. For instance, imagine the following HTML design file:

<html>
 <body>
  <!-- cut:block -->
   <div class="block">
    <!-- cut:diamond -->
     <diamond></diamond>
    <!-- /cut:diamond -->
   </div>
  <!-- /cut:block -->
 </body>
</html>
			
tck design.html
generating: ./diamond.html
generating: ./block.html
generating: ./layout.html
$_

Each file will contain one snippet of HTML specified by the region markers in the design file. For instance block.html will contain:

<div class="block" >
 <!-- paste:diamond -->
</div>

Special tck-attributes are processed like this:

<img...
data-tck="&src"...
src="demo_image.jpg">
<input data-tck="&checked" >

becomes:

<img #&src# >
<input #&checked# >

Why?

Download: tck on git