Socket
Book a DemoInstallSign in
Socket

jquery-template-engine

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-template-engine

Simple jQuery Template Engine

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

jquery-template-egine

jQuery simple template engine with support for loops and conditional data

Installation

Import this JS in your HTML

<script src="https://cdn.jsdelivr.net/npm/jquery-template-engine@1.0.1"></script>

or install it via npm

npm i --save jquery-template-engine

Usage

In your HTML, use the data-te attributes for preparing the templates:

<h1 data-te-v="selection.country"></h1>
<p data-te-v="selection.city"></p>
<p>Other cities...</p>
<ul data-te-for="city of cities">
  <li data-te-v="city.name"></li>
</ul>

And then you can use:

$("body").templateEngine({
    selection : {
      country: 'Spain',
      city: 'Valencia'
    },
    cities : [
      {name : 'Barcelona'},
      {name : 'Madrid'},
      {name : 'Sevilla'},
      {name : 'Valencia'}
    ]
  })

Features

FAQs

Package last updated on 27 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts