Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

twing

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twing

First-class Twig engine for the JavaScript ecosystem

latest
Source
npmnpm
Version
7.3.1
Version published
Weekly downloads
14K
-11.17%
Maintainers
1
Weekly downloads
 
Created
Source

Twing

NPM version Build Status Coverage percentage Donate

First-class JavaScript Twig compiler

Prerequisites

Twing needs at least node.js 16.0.0 to run.

Installation

The recommended way to install Twing is via npm:

npm install twing --save

Documentation

See the Twing website for documentation.

Basic API Usage

import {createEnvironment, createArrayLoader} from "twing";

const loader = createArrayLoader({
    'index.twig': 'Everybody loves {{ name }}!'
});

const environment = createEnvironment(loader);

environment.render('index.twig', {name: 'Twing'}).then((output) => {
    // output contains "Everybody loves Twing!"
});

Script tag

Use cdnjs to include Twing in your HTML document.

Once loaded by the browser, Twing is available under the global Twing variable.

  • gulp-twing: Compile Twig templates with gulp. Build upon Twing.
  • twing-loader: Webpack loader that compiles Twig templates using Twing.

License

Copyright © 2018 Eric MORAND. Released under the 2-Clause BSD License.

Keywords

browser

FAQs

Package last updated on 09 Feb 2026

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