|
1 | 1 | <p align="center"> |
2 | 2 | <img src="https://raw.githubusercontent.com/openpeeps/tim/main/.github/timengine.png" alt="Tim - Template Engine" width="200px" height="200px"><br> |
3 | | - ⚡️ A universal, high-performance templating engine & markup language<br> |
| 3 | + ⚡️ A high-performance templating engine & markup language<br> |
4 | 4 | <strong>Fast</strong> • <strong>Compiled</strong> • <strong>Source-to-Source</strong> • <strong>Interpreter</strong><br> |
5 | 5 | </p> |
6 | 6 |
|
|
10 | 10 |
|
11 | 11 | ## Key features |
12 | 12 | - Fast, compiled, clean syntax |
13 | | -- Template engine + Hybrid programming language |
| 13 | +- Template engine |
14 | 14 | - Source-to-Source transpilation to Nim, Go, JavaScript |
15 | 15 | - Standalone CLI & AST-based Interpreter |
16 | 16 | - Standard Library |
17 | | -- Transpiles timl code to JavaScript snippets for **Client-Side Rendering** |
| 17 | +- Transpiles timl code to JavaScript for CSR (**Client-Side Rendering**) |
18 | 18 | - Built-in **Browser Sync & Reload** |
19 | 19 | - Built-in Package Manager |
20 | 20 | - Written in Nim language 👑 |
21 | 21 |
|
22 | | -## About |
23 | | -Tim Engine is reinventing the way we write front-end layouts. |
24 | | - |
25 | | -Think about HTML but without the `<` `>` nightmares! |
26 | | - |
27 | | -So it's time to bring the `template engine` phrase back in Google Trends! |
28 | | - |
29 | | -## The thing is... |
30 | | -When it comes to performance, JIT (Just-In-Time) compilation can be a double-edged sword. While it provides a nice boost during |
31 | | -development, its overhead can slow down the interpreter in production environments. |
32 | | - |
33 | | -For development purposes, leveraging the internal interpreter makes sense due to its speed and ease of use. However, for production |
34 | | -scenarios, consider bundling your front-end application or transpiling to your preferred target source (Nim, JavaScript, Ruby and more) |
35 | | -to minimize overhead and ensure optimal performance. |
36 | | - |
37 | | -## Tim Engine CLI |
38 | | -The `⚑` tells that the commands contains additional flags. For printing flags and any extra information use `tim -h` or `tim --help`. |
39 | | -``` |
40 | | -Source-to-Source |
41 | | - src <timl> ⚑ Transpile `timl` to a target source |
42 | | - ast <timl> <output> ⚑ Serialize template to binary AST |
43 | | - repr <ast> <ext> ⚑ Deserialize binary AST to target source |
44 | | -Microservice |
45 | | - new <config> ⚑ Initialize a Tim Engine config file |
46 | | - api <config> ⚑ Run Tim Engine transpiler as a HTTP API Server |
47 | | - build <ast> ⚑ Build pluggable templates from `.timl` to `.so` (requires Nim) |
48 | | - bundle <config> ⚑ Bundle a standalone front-end app from project (requires Nim) |
49 | | -Development |
50 | | - install <pkg> ⚑ Install a package from remote source |
51 | | - uninstall <pkg> ⚑ Uninstall a package from local source |
52 | | -``` |
53 | | - |
54 | | -## Tim Engine Language |
55 | | -Tim is more than just a templating engine. It's a language! Tim's syntax is very similar with Nim's syntax |
56 | | - |
57 | | -**Variables** |
58 | | -```timl |
59 | | -// a mutable variable using `var` |
60 | | -var title = "Tim is Awesome" |
61 | | -
|
62 | | -// a immutable variable using `const` |
63 | | -const name = "Tim Engine" |
64 | | -``` |
65 | | - |
66 | | -**Data Types** |
67 | | -``` |
68 | | -// single quote strings: 'Single line strings' |
69 | | -// double quote strings: "Awesome is Awesome" |
70 | | -
|
71 | | -// triple quote strings are usually used for |
72 | | -// defining JavaScript scripts or stylesheets |
73 | | -
|
74 | | -// Integers: 123 + 2 |
75 | | -// Float numbers: 15.5 * 10 |
76 | | -// Boolean: `true` or `false` |
77 | | -``` |
78 | | - |
79 | | -**Functions** |
80 | | -```timl |
81 | | -fn hi(x: string): string = |
82 | | - return $x & "!" |
83 | | -
|
84 | | -// wait, you can define function bodies within brackets! |
85 | | -fn hiAgain(x: string): string { |
86 | | - return $x & "!" |
87 | | -} |
88 | | -
|
89 | | -// calling the function |
90 | | -h1.fw-bold > span: hi("Hello World") |
91 | | -``` |
92 | | - |
93 | | -### Source-to-Source transpilation |
94 | | -Keep your logic 100% portable while transpiling your front-end to other target sources. |
95 | | - |
96 | | -Use Tim as a development tool and transpile your code to your to your desired target |
97 | | -source code at compile-time with zero-cost runtime. |
98 | | - |
99 | | -Currently supported source languages, `JavaScript`, `Nim`, `Python`, `HTML`. |
100 | | -**Note** transpiling to HTML will invoke the built-in AST interpreter. While for the other target sources will |
101 | | -translate code to selected target |
102 | | - |
103 | | - |
104 | | -### API Render Server |
105 | | -Tim Engine exposes a local HTTP API server that listens to `http://`, enabling source to source transpilation programatically |
106 | | - |
107 | | - |
108 | | -### Parse JSON, YAML and Markdown |
109 | | -Tim provides built-in functionality for parsing JSON, YAML and Markdown contents. |
110 | | - |
111 | | -While at runtime you have `json`, `jsonRemote`, `yaml`, `yamlRemote`, `markdown` and `markdownRemote` for reading contents |
112 | | -from local or remote sources. Here is an example |
113 | | - |
114 | | -### Package Manager |
115 | | -Use Tim's built-in package manager to install packages for Tim engine. |
116 | | - |
117 | | -### Theme Manager |
118 | | -Use Tim's built-in theme manager to create theme management systems for your web app. |
| 22 | +wip |
0 commit comments