Skip to content

FlamesX-128/denoTag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deno Tag

A simple HTML preprocessor for Deno.

Example

import { render } from "https://deno.land/x/[email protected]/mod.ts";

const html = Deno.readTextFileSync(
    new URL("assets/main.html", import.meta.url)
);

console.log(
    await render(html, {
        params: {
            timestamp: Date.now()
        }
    })
)
<!-- You can use <deno>, <script type="application/typescript">, or a custom query by adjusting the configuration. -->
<body>
    <p>
        The value of the fibonacci sequence is:
        <script type="application/typescript">
            function fibonacci(n: number): number {
                if (n <= 1) {
                    return n;
                }
                return fibonacci(n - 1) + fibonacci(n - 2);
            }
    
            return fibonacci(20);
        </script>
    </p>

    <deno>
        return Date.now() - params.timestamp;
    </deno>
</body>
<!-- When evaluated, it becomes into this -->
<body>
    <p>
        The value of the fibonacci sequence is:
        6765
    </p>

    13
</body>