themeleon-swig

Swig mixin for Themeleon.

This is native with Themeleon 3.0
Last updated 12 years ago by valeriangalliat .
Unlicense · Repository · Bugs · Original npm · Tarball · package.json
$ npm install themeleon-swig 
SYNC missed versions from official npm registry.

Themeleon Swig

Swig mixin for Themeleon.

Warning: this repository/package is deprecated, template engines will be handled by consolidate.js in Themeleon 3.0.

Installation

In your package.json:

{
  "dependencies": {
    "themeleon": "1.*",
    "themeleon-swig": "1.*"
  }
}

Usage

var themeleon = require('themeleon')();

// Use the Swig mixin
themeleon.use('swig');

// Or inject your own instance
themeleon.use('swig', require('swig'));

module.exports = themeleon(__dirname, function (t) {
  // Compile a Swig view as `index.html` in destination directory
  t.swig('views/index.html.swig', 'index.html');
});

Using Twig extras

// Create a local Swig instance instead of altering the globale one
var swig = new (require('swig').Swig)();

var extras = require('swig-extras'); // Moar filters
var themeleon = require('themeleon')(); // No change here

// Use some additional filters
extras.useFilter(swig, 'nl2br');
extras.useFilter(swig, 'split');
extras.useFilter(swig, 'trim');
extras.useFilter(swig, 'groupby');

// Even add your own filters
swig.setFilter('push', function (arr, val) {
  return arr.push(val);
});

// Tell Themeleon to use your own Swig instance
themeleon.use('swig', swig);

Current Tags

  • 1.0.3                                ...           latest (12 years ago)

7 Versions

  • 1.0.3 [deprecated]           ...           12 years ago
  • 1.0.2 [deprecated]           ...           12 years ago
  • 1.0.1 [deprecated]           ...           12 years ago
  • 1.0.0 [deprecated]           ...           12 years ago
  • 0.2.1 [deprecated]           ...           12 years ago
  • 0.2.0 [deprecated]           ...           12 years ago
  • 0.1.0 [deprecated]           ...           12 years ago
Downloads
Total 26
Today 0
This Week 5
This Month 17
Last Day 0
Last Week 4
Last Month 0
Dependencies (4)
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE