Fork of https://gitlab.com/nightlycommit/twing with a better build system
Go to file
2018-03-06 00:28:47 +01:00
docs Improve homepage and license 2018-03-06 00:28:47 +01:00
src Fix issue #88 2018-03-05 16:54:28 -05:00
tasks Fix issue #72 2018-03-04 02:52:45 -05:00
test Fix issue #77 2018-03-05 18:41:36 +01:00
.editorconfig Fix issue #54 2018-02-25 22:44:43 +01:00
.gitignore Fix issue #62 2018-03-03 15:50:21 +01:00
.npmignore Fix issue #86 2018-03-05 22:41:56 +01:00
.nycrc Fix issue #62 2018-03-03 15:50:21 +01:00
.travis.yml Implement issue #17 2018-02-07 15:10:29 -05:00
LICENSE Improve homepage and license 2018-03-06 00:28:47 +01:00
package-lock.json Fix issue #77 2018-03-05 18:41:36 +01:00
package.json Fix issue #77 2018-03-05 18:41:36 +01:00
README.md Fix issue #90 2018-03-06 00:17:14 +01:00
tsconfig.json Fix issue #62 2018-03-03 15:50:21 +01:00

Twing

NPM version Build Status Dependency Status Coverage percentage

First-class Twig engine for Node.js

Philosophy behind Twing

We believe that a first-class Twig engine should be able to render any template to the exact same result as the official PHP engine. That means that it should implement 100% of the syntax defined by the language specifications and that it should render that syntax using PHP logic.

We also believe that a first-class Twig engine should be able to catch-up easily when Twig specifications evolve. Its code architecture and philosophy should then be as close as possible as the PHP implementation.

Finally, we believe that a first-class Twig engine should allow users to build on their experience with TwigPHP and get support from the huge community that comes with it.

That's what Twing is. A maintainability-first engine that pass 100% of the TwigPHP integration tests, is as close as possible to its code structure and expose an as-close-as-possible API.

Prerequisites

Twing needs at least node.js 7.6.0 to run.

Installation

The recommended way to install Twing is via npm:

npm i twing --save

Basic API Usage

const Twing = require('twing');

let loader = new Twing.TwingLoaderArray({
    'index.twig': 'Hello {{ name }}!'
});
let twing = new Twing.TwingEnvironment(loader);

let output = await twing.render('index.twig', {name: 'Fabien'});

More information

Read the documentation for more information.

Contributing

  • Fork this repository
  • Code
  • Implement tests using node-tap
  • Issue a pull request keeping in mind that all pull requests must reference an issue in the issue queue

License

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