Socket
Socket
Sign inDemoInstall

twing

Package Overview
Dependencies
34
Maintainers
1
Versions
125
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    twing

First-class Twig engine for Node.js


Version published
Maintainers
1
Install size
9.28 MB
Created

Readme

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 jsdelivr CDN to include Twing in your HTML document:

<script src="https://cdn.jsdelivr.net/npm/twing/dist/lib.min.js"></script>

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

FAQs

Last updated on 17 Apr 2024

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