grunt-web-swig
Compile swig/django templates to html files.
Getting Started
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-web-swig --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
The "web_swig" task
Overview
In your project's Gruntfile, add a section named web_swig
to the data object passed into grunt.initConfig()
.
grunt;
Options
options.swigOptions
Type: Object
Default value: {cache: false}
see http://paularmstrong.github.io/swig/docs/api/#SwigOpts.
options.djangoOptions
Type: Object
Default value: undefined
see https://github.com/yanni4night/django#configurations.
options.getData
Type: Function
or Object
Default value: function(tpl){return {};}
Mock data for each source template file.
options.useDjango
Type: Boolean
Default value: false
Use Django's template syntax.Note you have to follow some instructions about python env,see https://www.npmjs.org/package/django#install.
1.7
is supported now.
options.ignorePrefix
Type: String
Default value: undefined
If you're using absolute path in @include or @extend,you have to define template_dirs or loader for django or swig,beside that you have to define an ignorePrefix to remove the prefix path returned by grunt.
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.