Here the target and the source HTML are the same. The HTML will replace itself.
Player
Chloe
Team Name
PositionPlayerScore
1Chloe20

Compile your HTML and get a higher rendering speed

All the examples we provided are compiled on the fly, when you render them.
The time taken to transform is equal to the compilation time + the rendering time.
This compilation takes some time. Altough it is very short, you may want to suppress this processing time in your production system.
It is possible to compile all the HTMLs and then save them as JS functions in a javascript file.
Once you have this .js file you can add it to your page using the <script> tag
By doing this you:
  1. Remove all the js commands related to the directives. And save the time spent on compiling.
  2. Save some Kb: The js file will be cached and you can remove the pure.js file from your page if you do not have to compile any template on the fly.
Click the button below to get the examples 4, 5 and 6 compiled and get the JS source code in the text area.

Copy paste the content of the text area above to a JS file. Save it. You can even minify and/or gzip it.
Then include this JS file in your pages. Your compiled HTML's will be available and cached by the browser as any other JS file.

Here is an example of a page that uses compiled templates