Tuesday, 30 May 2017

Browser Sync throwing error: No "browserSync" targets found (Grunt.js)

I am using Grunt for a local project set up and all the tasks are running fine (concat, uglify etc) however I have been running into problems with Browser Sync. Every time I run grunt watch or grunt default I get the following error:

No "browserSync" targets found.

I am not sure what it means, I have researched online but cannot find anything that will tell me in plain english what that error might mean...

I have declared the dependancy in my package.json file and installed it via npm install.

In my gruntfile.js I have the following watch task setup:

 watch: {
    files: ['<%= jshint.files %>'],
    tasks: ['jshint', 'compass','uglify'],
    css: {
        files: 'assets_src/sass/*.scss',
          tasks: ['compass', 'concat'],
          options: {
            livereload: true,
          }, 
      },
    js: {
      files: 'assets_src/js/*.js',
      tasks: ['compass', 'concat'],
      options: {
        livereload: true,
      },
    },
    browserSync: {
        dev: {
            bsFiles: {
                src: ['assets_src/sass/*.scss', 'assets_src/js/*.js']
            }
        },
        options: {
            watchTask: true,
            proxy: 'http://wordpressboilerplate.dev.co.uk/'
        }
    },
  }

I am loading the NPM task:

grunt.loadNpmTasks('grunt-browser-sync');

In my default task I have the following:

grunt.registerTask('default', ['browserSync','jshint', 'concat', 'uglify', 'compass']);

Can anyone help or at the very least explain what the error (No "browserSync" targets found.) means?



via Neelam Khan

No comments:

Post a Comment