Skip to content

FlamesX-128/denoTag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deno Tag

A simple html preprocessor for deno.

ChangeLog

0.1.0 - Server variables:

  • Now you can use send variables.

0.0.2 - Bug in await fixed:

  • Fixed a bug that did not allow use of await.

0.0.1 - First release:

  • This is the first version!

Examples

Example One:

// main.ts
import render from "https://deno.land/x/denotag/mod.ts";

(async function main() {
  const res = await render("./main.html");
  
  console.log(res);
})();
<!-- main.html -->
<body>
  <deno>
    // This is a standard function that adds something to the html.
    Write("Hello world");
  </deno>
</body>

Result:

<body>
  Hello world
</body>

Example Two:

// main.ts
import render from "https://deno.land/x/denotag/mod.ts";

(async function main() {
  const res = await render("./main.html", {
    hello: "hello world!"
  });
  
  console.log(res);
})();
<!-- main.html -->
<body>
  <deno>
    for (const txt of ["orange", "apple"]) 
      write(txt);
    
    // Get sent variable.
    write(data.hello)
  </deno>
</body>

Result:

<body>
  orange
  apple
  hello world!
</body>

Information:

Deno tag only accepts JS, tested with:

  • deno 1.14.3 (release, x86_64-unknown-linux-gnu)

  • v8 9.4.146.19

  • typescript 4.4.2