|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + |
| 4 | +<head> |
| 5 | + <meta charset="UTF-8"> |
| 6 | + <title>micro-template.js Landing Page</title> |
| 7 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 8 | + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-tomorrow.min.css"> |
| 9 | + <script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.min.js" defer></script> |
| 10 | + <script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-javascript.min.js" defer></script> |
| 11 | + <script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-markup.min.js" defer></script> |
| 12 | + <style> |
| 13 | + html { |
| 14 | + background: #f8fafc; |
| 15 | + } |
| 16 | + |
| 17 | + body { |
| 18 | + background: #fff; |
| 19 | + color: #222; |
| 20 | + font-family: 'Fira Mono', 'Menlo', 'Consolas', 'monospace', 'sans-serif'; |
| 21 | + margin: 0 auto; |
| 22 | + max-width: 820px; |
| 23 | + padding: 2.5em 1.5em 1.5em 1.5em; |
| 24 | + border-radius: 12px; |
| 25 | + box-shadow: 0 4px 32px #0001; |
| 26 | + } |
| 27 | + |
| 28 | + header { |
| 29 | + text-align: center; |
| 30 | + margin-bottom: 2.5em; |
| 31 | + } |
| 32 | + |
| 33 | + h1 { |
| 34 | + font-size: 2.5em; |
| 35 | + letter-spacing: -1px; |
| 36 | + margin-bottom: 0.2em; |
| 37 | + color: #222; |
| 38 | + } |
| 39 | + |
| 40 | + .subtitle { |
| 41 | + color: #2d8f6f; |
| 42 | + font-size: 1.1em; |
| 43 | + margin-top: 0; |
| 44 | + margin-bottom: 0.5em; |
| 45 | + font-family: 'Fira Mono', 'Menlo', 'Consolas', 'monospace', 'sans-serif'; |
| 46 | + } |
| 47 | + |
| 48 | + h2 { |
| 49 | + color: #2d8f6f; |
| 50 | + font-size: 1.3em; |
| 51 | + margin-top: 2em; |
| 52 | + margin-bottom: 0.7em; |
| 53 | + border-left: 4px solid #2d8f6f; |
| 54 | + padding-left: 0.5em; |
| 55 | + letter-spacing: 0.5px; |
| 56 | + } |
| 57 | + |
| 58 | + ul { |
| 59 | + padding-left: 1.5em; |
| 60 | + margin-bottom: 1.5em; |
| 61 | + } |
| 62 | + |
| 63 | + li { |
| 64 | + margin-bottom: 0.5em; |
| 65 | + line-height: 1.7; |
| 66 | + } |
| 67 | + |
| 68 | + .usage { |
| 69 | + margin-bottom: 2.5em; |
| 70 | + } |
| 71 | + |
| 72 | + .usage-blocks { |
| 73 | + } |
| 74 | + |
| 75 | + .usage-block { |
| 76 | + background: #f6f8fa; |
| 77 | + border-radius: 8px; |
| 78 | + padding: 1em 1em 0.5em 1em; |
| 79 | + margin-bottom: 1em; |
| 80 | + box-shadow: 0 2px 8px #0001; |
| 81 | + } |
| 82 | + |
| 83 | + .usage-block h3 { |
| 84 | + margin-top: 0; |
| 85 | + color: #eab308; |
| 86 | + font-size: 1.1em; |
| 87 | + letter-spacing: 0.2px; |
| 88 | + } |
| 89 | + |
| 90 | + pre { |
| 91 | + background: #f3f3f3; |
| 92 | + color: #2563eb; |
| 93 | + border-radius: 6px; |
| 94 | + padding: 1em; |
| 95 | + font-size: 0.98em; |
| 96 | + overflow-x: auto; |
| 97 | + margin: 0 0 1em 0; |
| 98 | + border: 1px solid #e5e7eb; |
| 99 | + } |
| 100 | + |
| 101 | + code { |
| 102 | + font-family: inherit; |
| 103 | + } |
| 104 | + |
| 105 | + .links { |
| 106 | + text-align: center; |
| 107 | + margin: 2.5em 0 2em 0; |
| 108 | + } |
| 109 | + |
| 110 | + a.button { |
| 111 | + display: inline-block; |
| 112 | + padding: 0.7em 1.7em; |
| 113 | + background: linear-gradient(90deg, #2d8f6f 0%, #38bdf8 100%); |
| 114 | + color: #fff; |
| 115 | + font-weight: bold; |
| 116 | + border-radius: 6px; |
| 117 | + text-decoration: none; |
| 118 | + margin: 0 0.7em 0.7em 0; |
| 119 | + font-size: 1.1em; |
| 120 | + letter-spacing: 0.5px; |
| 121 | + box-shadow: 0 2px 8px #0001; |
| 122 | + transition: background 0.2s, color 0.2s; |
| 123 | + } |
| 124 | + |
| 125 | + a.button:hover { |
| 126 | + background: linear-gradient(90deg, #eab308 0%, #2d8f6f 100%); |
| 127 | + color: #fff; |
| 128 | + } |
| 129 | + |
| 130 | + .demo { |
| 131 | + margin-bottom: 2.5em; |
| 132 | + } |
| 133 | + |
| 134 | + .demo-iframe { |
| 135 | + width: 100%; |
| 136 | + height: 480px; |
| 137 | + border: none; |
| 138 | + border-radius: 8px; |
| 139 | + box-shadow: 0 2px 16px #0001; |
| 140 | + background: #fff; |
| 141 | + margin-top: 1em; |
| 142 | + } |
| 143 | + |
| 144 | + footer { |
| 145 | + text-align: center; |
| 146 | + color: #888; |
| 147 | + font-size: 0.98em; |
| 148 | + margin-top: 2.5em; |
| 149 | + padding-bottom: 1em; |
| 150 | + } |
| 151 | + |
| 152 | + footer a { |
| 153 | + color: #2563eb; |
| 154 | + text-decoration: underline; |
| 155 | + font-weight: bold; |
| 156 | + transition: color 0.2s; |
| 157 | + } |
| 158 | + |
| 159 | + footer a:hover { |
| 160 | + color: #eab308; |
| 161 | + } |
| 162 | + </style> |
| 163 | +</head> |
| 164 | + |
| 165 | +<body> |
| 166 | + <header> |
| 167 | + <h1>micro-template.js</h1> |
| 168 | + <p class="subtitle">A minimal, blazing fast JavaScript template engine for hackers.</p> |
| 169 | + </header> |
| 170 | + <section class="features"> |
| 171 | + <h2>Features</h2> |
| 172 | + <ul> |
| 173 | + <li>Ultra-lightweight and extremely fast</li> |
| 174 | + <li>All output is HTML-escaped by default for security</li> |
| 175 | + <li>Shows template line numbers on errors for easy debugging</li> |
| 176 | + <li>Supports extensions (<code>include</code> / <code>wrapper</code>)</li> |
| 177 | + </ul> |
| 178 | + </section> |
| 179 | + <section class="usage"> |
| 180 | + <h2>Usage Example</h2> |
| 181 | + <div class="usage-blocks"> |
| 182 | + <div class="usage-block"> |
| 183 | + <h3>Basic</h3> |
| 184 | + <pre><code class="language-js">import { template } from 'micro-template'; |
| 185 | + |
| 186 | +const result = template('<div><%= message %></div>', { message: 'Hello, inline!' }); |
| 187 | +console.log(result); // <div>Hello, inline!</div> |
| 188 | +</code></pre> |
| 189 | + </div> |
| 190 | + <div class="usage-block"> |
| 191 | + <h3>In HTML</h3> |
| 192 | + <pre><code class="language-html"><script type="application/x-template" id="tmpl1"> |
| 193 | + <div><%= message %></div> |
| 194 | +</script> |
| 195 | +<script type="module"> |
| 196 | + import { extended as template } from './lib/micro-template.js'; |
| 197 | + const html = template('tmpl1', { message: 'Hello, world!' }); |
| 198 | + document.body.innerHTML += html; |
| 199 | +</script></code></pre> |
| 200 | + </div> |
| 201 | + <div class="usage-block"> |
| 202 | + <h3>In Node.js</h3> |
| 203 | + <pre><code class="language-js">import { template } from 'micro-template'; |
| 204 | +template.get = id => require('fs').readFileSync('tmpl/' + id + '.tmpl', 'utf-8'); |
| 205 | + |
| 206 | +const result = template('tmpl1', { message: 'Hello, Node!' }); |
| 207 | +console.log(result);</code></pre> |
| 208 | + </div> |
| 209 | + </div> |
| 210 | + </section> |
| 211 | + <section class="links"> |
| 212 | + <a class="button" href="https://github.com/cho45/micro-template.js" target="_blank">GitHub</a> |
| 213 | + <a class="button" href="https://cho45.github.io/micro-template.js/misc/demo.html" target="_blank">Demo Page</a> |
| 214 | + </section> |
| 215 | + <footer> |
| 216 | + <span>© cho45 / <a href="https://github.com/cho45/micro-template.js" target="_blank">micro-template.js</a> |
| 217 | + - MIT License</span> |
| 218 | + </footer> |
| 219 | + <script type="application/x-template" id="tmpl1"> |
| 220 | + <div><%= message %></div> |
| 221 | + </script> |
| 222 | + <script type="module"> |
| 223 | + import { extended as template } from './lib/micro-template.js'; |
| 224 | + console.log('micro-template.js loaded', template); |
| 225 | + console.log('Template example:', template('tmpl1', { message: 'Hello, world!' })); |
| 226 | + </script> |
| 227 | +</body> |
| 228 | + |
| 229 | +</html> |
0 commit comments