Wondering what’s next for npm?Check out our public roadmap! »

    This package has been deprecated

    Author message:

    This is native with Themeleon 3.0

    themeleon-swig

    1.0.3 • Public • Published

    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);

    Keywords

    none

    Install

    npm i themeleon-swig

    DownloadsWeekly Downloads

    78

    Version

    1.0.3

    License

    Unlicense

    Last publish

    Collaborators

    • avatar
    • avatar