-
Notifications
You must be signed in to change notification settings - Fork 80
Grunt Tasks
You can manually run the grunt tasks on which lineman is built with the lineman grunt
command. (It just delegates through to grunt
.) You can also run any additional grunt tasks that you've added yourself.
$ lineman grunt <taskname>
Lineman can easily be extended to do extra grunt-work for your application above-and-beyond the built-in grunt tasks. You may add tasks to your project in two ways:
- Custom tasks you've written yourself:
- add it to the
tasks/
directory. Lineman will automatically load any tasks found here.
- add it to the
- NPM-packaged tasks:
- add it to your
package.json
as a dependency - add it to
loadNpmTasks
inconfig/application.js
using the task's NPM module name normally used ingrunt.loadNpmTasks('___')
- run
npm install
- add it to your
Once they're loaded, you can manually run the task from the command line using lineman grunt
but you're probably more interested in adding these tasks to run along with the other tasks in lineman run
and/or lineman build
...
You can add any task to the lineman run
and/or build
process by adding it to the appropriate array under the prependTasks
and appendTasks
objects in config/application.js
:
prependTasks: {
common: ["A"],
dev: ["B"],
dist: ["C"]
},
appendTasks: {
common: ["D"],
dev: ["E"],
dist: ["F"]
}
In the above example, tasks "A" & "D" would run during both lineman run
and lineman build
. Meanwhile, "B" & "E" would run only during lineman run
, while "C" & "F" would only run during lineman build
.
Tasks specified under prependTasks
way will be run before Lineman's built-in tasks for the corresponding phase, while tasks specified under appendTasks
will run immediately afterward. For reference, check out Lineman's default configuration.
If you need more fine-grained control—say you want to replace or remove a default task—you can use custom JavaScript in your application config file to edit the appropriate array directly; here's an example of removing a task from the Ember.js template.