Search code examples
gruntjslinemanjs

Add grunt task to linemanjs application.js


I want to add a grunt task (specifically angular-template) to my lineman application.js file. There is some documentation found here and here. However, it just tells me to add the grunt task to loadNpmTasks. The problem is that from a fresh project created using lineman, my application.js file does not have a loadNpmTasks array, nor do the comments point out where I should put it. Both examples I have found in the documentations do not show what the application.js file should look like in it's entirety.


Solution

  • The application.js file should look something like this (obviously the src/dest options are not configured correctly:

    module.exports = function(lineman) {
      return {
        loadNpmTasks:['grunt-angular-templates'],
    
        ngtemplates:  {
            app:        {
                src: '**.html',
                dest: 'templates.js'
            }
        }
      };
    };
    

    Then to run the task:

    lineman grunt ngtemplates