{"action":"created","issue":{"url":"https://api.github.com/repos/gruntjs/grunt/issues/696","labels_url":"https://api.github.com/repos/gruntjs/grunt/issues/696/labels{/name}","comments_url":"https://api.github.com/repos/gruntjs/grunt/issues/696/comments","events_url":"https://api.github.com/repos/gruntjs/grunt/issues/696/events","html_url":"https://github.com/gruntjs/grunt/issues/696","id":11516255,"number":696,"title":"Submodules using grunt.loadNpmTasks need to use their own node_modules directory","user":{"login":"dylang","id":51505,"avatar_url":"https://avatars.githubusercontent.com/u/51505?v=3","gravatar_id":"","url":"https://api.github.com/users/dylang","html_url":"https://github.com/dylang","followers_url":"https://api.github.com/users/dylang/followers","following_url":"https://api.github.com/users/dylang/following{/other_user}","gists_url":"https://api.github.com/users/dylang/gists{/gist_id}","starred_url":"https://api.github.com/users/dylang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylang/subscriptions","organizations_url":"https://api.github.com/users/dylang/orgs","repos_url":"https://api.github.com/users/dylang/repos","events_url":"https://api.github.com/users/dylang/events{/privacy}","received_events_url":"https://api.github.com/users/dylang/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2013-02-28T19:49:44Z","updated_at":"2015-03-25T15:55:27Z","closed_at":"2013-07-26T17:01:45Z","body":"We needed the code in the `Gruntfile.js` to be easily updatable via npm and shared across projects so we put it in another module and pass `grunt` to that module something like this:\r\n\r\n```\r\nmodule.exports = function(grunt) {\r\n  var gw = require('gruntwork');   \r\n  gw(grunt, { someOptions: true });\r\n};\r\n```\r\n\r\nBy default code in **that module** (gruntwork) cannot use `grunt.loadNpmTasks` to load **its dependences** because it looks for them in the wrong place: relative to root of the parent project.\r\n\r\nThis can addressed by adding the keyword `gruntcollection` in the submodule's  `package.json`, however this causes errors because not all the dependencies are grunt tasks so they don't all have a task directory. `gruntcollection` seems to be only for modules that have ONLY grunt tasks as dependencies which seems like a good feature but not what we need in this case.\r\n\r\nI think a better solution might also help make it easier to split up Gruntfiles into smaller reusable modules that have their own devdependencies. "},"comment":{"url":"https://api.github.com/repos/gruntjs/grunt/issues/comments/86093817","html_url":"https://github.com/gruntjs/grunt/issues/696#issuecomment-86093817","issue_url":"https://api.github.com/repos/gruntjs/grunt/issues/696","id":86093817,"user":{"login":"gyandeeps","id":5554486,"avatar_url":"https://avatars.githubusercontent.com/u/5554486?v=3","gravatar_id":"","url":"https://api.github.com/users/gyandeeps","html_url":"https://github.com/gyandeeps","followers_url":"https://api.github.com/users/gyandeeps/followers","following_url":"https://api.github.com/users/gyandeeps/following{/other_user}","gists_url":"https://api.github.com/users/gyandeeps/gists{/gist_id}","starred_url":"https://api.github.com/users/gyandeeps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gyandeeps/subscriptions","organizations_url":"https://api.github.com/users/gyandeeps/orgs","repos_url":"https://api.github.com/users/gyandeeps/repos","events_url":"https://api.github.com/users/gyandeeps/events{/privacy}","received_events_url":"https://api.github.com/users/gyandeeps/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T15:55:27Z","updated_at":"2015-03-25T15:55:27Z","body":"I think with `nodejs 0.12.0` and `grunt 0.4.5`, this problem is resolved."}}