I have understood the concept of "require" and "module.export". Now as per my understanding if one file is exporting a module another file invoking that by using "require".
Now in writing grunt task , we write
module.exports = function(grunt){}
Now who requires the module and how grunt argument is passed? I mean how does it work?
Also if some one can tell me what is the life cycle of a node plugin?
Basically grunt is doing the require and than calling that exported function with its instance of grunt. you can see it in: task.js
// Load taskfile.
fn = require(path.resolve(filepath));
if (typeof fn === 'function') {
fn.call(grunt, grunt);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.