gulp-nodemon icon indicating copy to clipboard operation
gulp-nodemon copied to clipboard

No gulpfile found error

Open ashblue opened this issue 8 years ago • 1 comments

Whenever I use tasks as so I get the error No gulpfile found with gulp-nodemon when the server activates live reload. Looks like nodemon is looking for my gulpfile in the wrong place perhaps? I have my gulpfile in a nested directory and running via gulp --gulpfile dist/gulp/index.js --cwd ..

        return nodemon({
            script: 'dist/src/index.js',
            ext: 'ts',
            watch: ['src/**/*.ts'],
            tasks: ['myTaskName']
        });

ashblue avatar Jul 30 '17 11:07 ashblue

I wrote a command that fixes this issue. Currently the problem is the child process spawning doesn't support additional Gulp arguments. Adding these with a flag such as options.argsAdditional = [arg1, arg2, arg3] would solve the issue.

Example temporary shim.

        const n = nodemon({
            ext: 'ts',
            script: 'dist/src/index.js',
            watch: ['src/**/*.ts'],
        });

        n.on('restart', () => {
            cp.spawnSync('gulp', [MY_TASK_NAME, '--gulpfile', PATH_TO_GULP_FILE, '--cwd', '.'], {
                stdio: [0, 1, 2],
            });
        });

ashblue avatar Oct 15 '17 15:10 ashblue