{"action":"created","issue":{"url":"https://api.github.com/repos/gruntjs/grunt/issues/1523","repository_url":"https://api.github.com/repos/gruntjs/grunt","labels_url":"https://api.github.com/repos/gruntjs/grunt/issues/1523/labels{/name}","comments_url":"https://api.github.com/repos/gruntjs/grunt/issues/1523/comments","events_url":"https://api.github.com/repos/gruntjs/grunt/issues/1523/events","html_url":"https://github.com/gruntjs/grunt/issues/1523","id":160644052,"number":1523,"title":"Load grunt task from sub folder inside node_modules folder","user":{"login":"terenc3","id":766518,"avatar_url":"https://avatars.githubusercontent.com/u/766518?v=3","gravatar_id":"","url":"https://api.github.com/users/terenc3","html_url":"https://github.com/terenc3","followers_url":"https://api.github.com/users/terenc3/followers","following_url":"https://api.github.com/users/terenc3/following{/other_user}","gists_url":"https://api.github.com/users/terenc3/gists{/gist_id}","starred_url":"https://api.github.com/users/terenc3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terenc3/subscriptions","organizations_url":"https://api.github.com/users/terenc3/orgs","repos_url":"https://api.github.com/users/terenc3/repos","events_url":"https://api.github.com/users/terenc3/events{/privacy}","received_events_url":"https://api.github.com/users/terenc3/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-16T11:57:34Z","updated_at":"2016-06-30T08:47:04Z","closed_at":"2016-06-30T08:47:04Z","body":"I'de like to load grunt task from a dedicated module which contains my global grunt config. But at the moment the tasks can only be loaded from project/node_modules.\r\n\r\nMy Target is the following:\r\n__structure__\r\n```\r\nproject/\r\n    Gruntfile.js\r\n    node_modules/\r\n        grunt-config-widgets/\r\n            index.js\r\n            node_modules/\r\n                grunt-contrib-clean\r\n```\r\n\r\n__Gruntfile.js__\r\n```\r\nmodule.exports = function(grunt) {\r\n    require('grunt-config-widgets')(grunt);\r\n};\r\n```\r\n\r\n__index.js__\r\n```\r\nmodule.exports = function(grunt) {\r\n    var gruntConfig = {\r\n        clean: ['foo', 'bar']\r\n    };\r\n\r\n    grunt.initConfig(gruntConfig);\r\n\r\n    // the loadNpmTasks should be accepting am aditional parameter so tasks can be searched inside a node_module\r\n    grunt.loadNpmTasks('grunt-contrib-clean', __dirname);\r\n\r\n    grunt.registerTask('default', ['clean']);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/gruntjs/grunt/issues/comments/229599540","html_url":"https://github.com/gruntjs/grunt/issues/1523#issuecomment-229599540","issue_url":"https://api.github.com/repos/gruntjs/grunt/issues/1523","id":229599540,"user":{"login":"terenc3","id":766518,"avatar_url":"https://avatars.githubusercontent.com/u/766518?v=3","gravatar_id":"","url":"https://api.github.com/users/terenc3","html_url":"https://github.com/terenc3","followers_url":"https://api.github.com/users/terenc3/followers","following_url":"https://api.github.com/users/terenc3/following{/other_user}","gists_url":"https://api.github.com/users/terenc3/gists{/gist_id}","starred_url":"https://api.github.com/users/terenc3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terenc3/subscriptions","organizations_url":"https://api.github.com/users/terenc3/orgs","repos_url":"https://api.github.com/users/terenc3/repos","events_url":"https://api.github.com/users/terenc3/events{/privacy}","received_events_url":"https://api.github.com/users/terenc3/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T08:47:04Z","updated_at":"2016-06-30T08:47:04Z","body":"It's a shame i didn't find this method earlier. I can set a different base in my grunt-config-widgets module before loading the tasks. Works perfectly in my test, so i renameing this issue and close it.\r\n\r\n__index.js__\r\n```\r\nmodule.exports = function(grunt) {\r\n    var gruntConfig = {\r\n        clean: ['foo', 'bar']\r\n    };\r\n\r\n    grunt.initConfig(gruntConfig);\r\n\r\n    // the loadNpmTasks should be accepting am aditional parameter so tasks can be searched inside a node_module\r\n\r\n    var cwd = process.cwd();\r\n\r\n    grunt.file.setBase(__dirname);\r\n    grunt.loadNpmTasks('grunt-contrib-clean');\r\n    grunt.file.setBase(cwd);\r\n\r\n    grunt.registerTask('default', ['clean']);\r\n}\r\n```"}}
{"actor":{"display_login":"terenc3"}}