ChrisWren / grunt-nodemon

Grunt task to run nodemon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to start another task after the nodemon server is listening?

codeofnode opened this issue · comments

I am using grunt task-runner in nodejs application.

I want to run another grunt task only after the server started by nodemon is listening to a port. Please note that i can't run the tasks concurrently (because i don't know in how much time server will start listening), so grunt-concurrent didn't helped.

How could i do that.?

I have the following task config with grunt-nodemon:

nodemon: {
        dev: {
            script: 'server.js',
            options: {
                // options ..
                callback : function(nodemon){
                    nodemon.on('config:update',function(){
                        console.log('reached here .. '); // this get consoled on screen
                        grunt.task.run('mynewtask');
                    });
                },
                // options ...
            }
        },
        exec: {
            options: {
                exec: 'less'
            }
        }
    }
```javascript

But nothing happens after server start listening. mynewtask does not start at all. Not even any error is shown.

Any updates on this? If I put a non-existing task, it fails, but when I put an existing one it doesn't seem to be doing anything.