Mantri As a Grunt Plugin

Mantri provides Grunt tasks to help you automate your flows. If you are not familiar with Grunt you should have a look at the Grunt's Getting Started guide and make sure you have installed it properly.

Grunt install cheat sheet:

npm install -g grunt-cli
npm install grunt --save-dev

Running grunt --help at the command line will list the available Mantri tasks. In addition, Mantri and Grunt should be listed in package.json as a devDependency, which ensures that they will be installed whenever the npm install command is run.


Here is a quick sample of a Gruntfile with Mantri directives.

module.exports = function( grunt ) {


    mantriDeps: {
      options: {
        root: 'static'
      target: {
        src: 'static/js'
    mantriBuild: {
      target: {
        dest: 'static/dist/app.min.js'

  // Create shortcuts to main operations.
  grunt.registerTask('deps', ['mantriDeps']);
  grunt.registerTask('build', ['mantriBuild:target']);

  // the default task, when 'grunt' is executed with no options.
  grunt.registerTask('default', ['deps']);

The mantriDeps Task

Read the details of the Grunt Task mantriDeps.

The mantriBuild Task

Read the details of the Grunt Task mantriBuild.

The mantriInit Task

mantriInit does not require any configuration. It is a simple task that helps you get started with your application.

For now it will copy the mantri.web.js and mantriConf.json files to the folder you define. If no folder is defined then the files will be copied to the folder where your Gruntfile is, which typically is your project's root.

This is how to call mantriInit with no folder defined:

grunt mantriInit

If your webroot is in folder www:

grunt mantriInit:www