Socket
Socket
Sign inDemoInstall

arc-templates

Package Overview
Dependencies
132
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    arc-templates

Fully powered JavaScript template engine with halfway-decent syntax.


Version published
Maintainers
1
Install size
14.1 MB
Created

Readme

Source

arc-templates

Fully powered ES6 JavaScript template engine with halfway-decent syntax.

GitHub version Build Status (lint + tests)

Dependency Status devDependency Status

There are two "builds" available: a Node.js 4+ version with minimal Babel transpiling, and an ES5 version with full Babel transpiling. The unit tests are run on both new and older Node versions.

Simple example

Templates can use expressions:

Hello, ${ name }

with a data object of { name: 'world' } will result in:

Hello, world

Loops

JavaScript blocks with nested document blocks allow a natural expression of loops:

<% for (let item of items) { <:<div>${item}</div>:> } %>

Layouts

Templates can define layouts for a "template of the template":

<! layout.html !><div>body</div>

If layout.html contains:

<html><head></head><body><**></body></html>

Then the final result is:

<html><head></head><body><div>body</div></body></html>

Templates can also define multiple named blocks for use by the layout template; for example, separate sections for the head and body in an HTML document.

Partials

Templates can also include other templates in their output:

before <( include.html )> after

If include.html contains:

middle

Then the final result is:

before middle after

Keywords

FAQs

Last updated on 07 Oct 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc