Skip to content

Commit

Permalink
Renamed the configuration to loadNpmTasks
Browse files Browse the repository at this point in the history
"app" isn't especially meaningful in this case, so
keeping the name the same as the grunt API seems
better to me (informed by my own messing up twice, 
thinking that the name was "addNpmTasks")
  • Loading branch information
searls committed May 18, 2013
1 parent 6307ef0 commit 567a04c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,15 @@ Once that configuration has been done, your tasks will be part of the `run` targ

### Adding NPM based tasks

To load NPM-based tasks that aren't part of the standard Lineman dependencies, you can add the module names to the `appNpmTasks`
object in `config/application.js`. Note that these still need to be installed, with `npm install <task> --save` or similar.
To load NPM-based tasks that aren't part of the standard Lineman dependencies, you can add the module names to the `loadNpmTasks` object in `config/application.js`. Note that these still need to be added to your app's `package.json` dependencies and installed to `node_modules` with `npm install`.

```javascript
appNpmTasks: [
"npm_task_to_load"
],
loadNpmTasks: ["npm_task_to_load"]
```

### Adding Custom tasks

Lineman will automatically require all files in the `tasks` directory and load them into Grunt. If you have custom tasks, you
Lineman will automatically require all files in the `tasks` directory and load them into Grunt. If you have custom tasks, you
can leave them there and add them to the build as above.

## Troubleshooting
Expand Down
14 changes: 7 additions & 7 deletions tasks/load-stuff.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fs = require('fs')

module.exports = (grunt) ->
appNpmTasks = require(process.cwd() + "/config/application").appNpmTasks ? []
loadNpmTasks = require("#{process.cwd()}/config/application").loadNpmTasks || []
linemanNpmTasks = [
"grunt-contrib-clean",
"grunt-contrib-coffee",
Expand All @@ -16,12 +16,12 @@ module.exports = (grunt) ->
"grunt-watch-nospawn"
]

grunt.util._
.chain(linemanNpmTasks)
.union(appNpmTasks)
.each (module) ->
if fs.existsSync("node_modules/#{module}")
grunt.util._(linemanNpmTasks).
chain().
union(loadNpmTasks).
each (module) ->
if fs.existsSync("#{process.cwd()}/node_modules/#{module}")
grunt.loadNpmTasks(module)
else
grunt.loadTasks(__dirname+"/../node_modules/#{module}/tasks")
grunt.loadTasks("#{__dirname}/../node_modules/#{module}/tasks")

0 comments on commit 567a04c

Please sign in to comment.