Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple watch configurations? #541

Open
kristianmandrup opened this issue May 6, 2017 · 3 comments
Open

Multiple watch configurations? #541

kristianmandrup opened this issue May 6, 2017 · 3 comments

Comments

@kristianmandrup
Copy link

Trying to set up different watch configurations for dev vs prod
What am I missing?

 Verifying property watch.dev.files exists in config...ERROR
    >> Unable to process task.
    Warning: Required config property "watch.dev.files" missing.
        concurrent: {
            dev: {
                tasks: ['nodemon', 'watch:dev'],
                options: {
                    logConcurrentOutput: true
                }
            },
            prod: {
                tasks: ['nodemon', 'watch:prod'],
                options: {
                    logConcurrentOutput: true
                }
            }
        },
        watch: {
            prod: {
                js: {
                    files: [
                        'editor/js/**/*.js'
                    ],
                    tasks: ['copy:build', 'concat', 'uglify', 'attachCopyright:js']
                },
                sass: {
                    files: [
                        'editor/sass/**/*.scss'
                    ],
                    tasks: ['sass', 'attachCopyright:css']
                },
                json: {
                    files: [
                        'nodes/core/locales/en-US/messages.json',
                        'red/api/locales/en-US/editor.json',
                        'red/runtime/locales/en-US/runtime.json'
                    ],
                    tasks: ['jsonlint:messages']
                },
                keymaps: {
                    files: [
                        'editor/js/keymap.json'
                    ],
                    tasks: ['jsonlint:keymaps', 'copy:build']
                },
                misc: {
                    files: [
                        'CHANGELOG.md'
                    ],
                    tasks: ['copy:build']
                }
            },
            dev: {
                js: {
                    files: [
                        'editor/js/**/*.js'
                    ],
                    tasks: ['copy:build', 'concat', 'babel']
                },
                sass: {
                    files: [
                        'editor/sass/**/*.scss'
                    ],
                    tasks: ['sass', 'attachCopyright:css']
                },
                json: {
                    files: [
                        'nodes/core/locales/en-US/messages.json',
                        'red/api/locales/en-US/editor.json',
                        'red/runtime/locales/en-US/runtime.json'
                    ],
                    tasks: ['jsonlint:messages']
                },
                keymaps: {
                    files: [
                        'editor/js/keymap.json'
                    ],
                    tasks: ['jsonlint:keymaps', 'copy:build']
                },
                misc: {
                    files: [
                        'CHANGELOG.md'
                    ],
                    tasks: ['copy:build']
                }
            }
@johnruane
Copy link

This is too many levels deep.

watch: {
  prod: {
    js: {

Can you prefix your watch tasks with 'prod_' or 'dev_', then call them like so:

tasks: ['nodemon', 'watch:dev_js', 'watch:dev_sass']

@aaronjpitts
Copy link

tasks: ['nodemon', 'watch:dev_js', 'watch:dev_sass'] doesn't work, it will only run the first watch task (watch:dev_js in this case)

@Samvanst
Copy link

Samvanst commented May 29, 2019

Hey i had the same issue and did the same logic as you but that didn't work.
The working solution and working like a charm is this one: https://stackoverflow.com/questions/13833196/gruntjs-watch-different-folders-and-execute-tasks
Hope this helps. you need to install the grunt plugin: https://www.npmjs.com/package/grunt-focus
then add like you tried with concurrent: this code

focus: {
develop: {
include: ['dev']
},
master: {
include: ['prod']
},
},

and make ure tasks like this:

grunt.registerTask('dev', 'compile develop', ['focus:develop']);
grunt.registerTask('prod', 'compile production', ['focus:master']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants