grunt-jp-swig

Compiles swig templates

npm install grunt-jp-swig
15 downloads in the last week
42 downloads in the last month

grunt-jp-swig Build Status

Swig templates compilation

Sample configuration:

"swig-browser": {
  frontTemplates:{
    options:{

      // window.<namespace>
      namespace: 'SWIG',

      // see: http://paularmstrong.github.io/swig/docs/api/#SwigOpts
      templateSettings: {},

      // see: http://perfectionkills.com/experimenting-with-html-minifier/#options
      htmlMinifySettings: {},

      amd: false,

      // init as a parent template
      layout: false,

      prettify: false,

      // attach swig browser env to a template function
      processor: false, 

      // modify template function source code 
      processContent: function(src) { return src; },

      // modify template name
      processName: function(name) { return name; },

      // additional filter list 
      filters:[]
    },

    files:{ 'dest.js': ['templates/**/*.swig'] }
  }    
}

In browser:

  var html = window.SWIG[<template name>]({});
npm loves you