Skip to main content
Deno 2 is finally here 🎉️
Learn more

Lara Template Deno

Lara Template Deno is a template compiler inspired by the Blade Template compiler of the Laravel Framework for the Deno runtime environment.

License (MIT) Version GitHub stars GitHub closed issues GitHub open issues GitHub Open Pull Request GitHub Closed Pull Request GitHub Commits

Features

  • Render
  • Compiler
  • Transpile
  • Minify
  • Formatter
  • Custom Directives
  • Global Scoped
  • Preload Code
  • Http Response
  • Temporal Data

Overview

What I am looking for with this tool is to facilitate the creation of templates quickly and efficiently, with the possibility for developers to add extra functionality through custom directives and adding functionality globally to the scoped.

Contents

Prerequisites

The following prerequisites are only necessary for the installation of Lara Template Deno

  • Deno@^1.32.1
Prerequisites Installation (Click to show)
  • to install deno you need to follow the steps in the following link Deno Install.

Installation

In order to use the lara template deno follow the following code as an example

you can import the library using this form

import { LaraDenoTemplate } from "https://deno.land/x/lara_template_deno/mod.ts";

or

import * as laraDenoTemplate from "https://deno.land/x/lara_template_deno/mod.ts";

Introduction

Create in your project or folder an index.ts file and place the following code

// imports the class LaraTemplateDeno
import { LaraDenoTemplate } from "https://deno.land/x/lara_template_deno/mod.ts"

// initializes the class
const denoTemplate = new LaraDenoTemplate();

// creates a variable containing the text to render
const render = `
    personal information:
    name {{ $name }}
    age {{ $age }}
`;

// pass it the variable containing the text to be rendered and an object with the properties and methods to be interpreted in the template
const result = await denoTemplate.render(render, {
    name: "jack",
    age: 27
});

// prints the result
console.log(result)

/**
 * Output
 *  personal information:
 *  name jack
 *  age 27
 */

Then you execute the following command

deno run -A index.ts

Examples

Used By

This project is used by the following companies:

Fork the repository, append your company’s name with the URL in above format inside the README.md file and make a PR! or create a GitHub issue mentioning (Site’s name & domain).

Feedback

Create an issue on github repo. and mention the details there.

Contributing

All contributions are super welcomed!

License

Lara Template Deno is provided under MIT License