Skip to content

Instantly share code, notes, and snippets.

@matt-bailey
Created June 19, 2013 16:05
Show Gist options
  • Select an option

  • Save matt-bailey/5815536 to your computer and use it in GitHub Desktop.

Select an option

Save matt-bailey/5815536 to your computer and use it in GitHub Desktop.
The 'watch' task in Gruntfile.js (as scaffolded by yo webapp)
grunt.initConfig({
yeoman: yeomanConfig,
watch: {
coffee: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
tasks: ['coffee:dist']
},
coffeeTest: {
files: ['test/spec/{,*/}*.coffee'],
tasks: ['coffee:test']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:server']
},
livereload: {
files: [
'<%= yeoman.app %>/*.html',
'{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
'{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
],
tasks: ['livereload']
}
},
@willforsyth
Copy link

grunt.initConfig({
    yeoman: yeomanConfig,
    watch: {
        options: {
            nospawn: true
        },
        coffee: {
            files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
            tasks: ['coffee:dist']
        },
        coffeeTest: {
            files: ['test/spec/{,*/}*.coffee'],
            tasks: ['coffee:test']
        },
        compass: {
            files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
            tasks: ['compass:server', 'autoprefixer' ]
        },
        styles: {
            files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
            tasks: ['copy:styles', 'autoprefixer']
        },
        livereload: {
            options: {
                livereload: LIVERELOAD_PORT
            },
            files: [
                '<%= yeoman.app %>/*.html',
                '.tmp/styles/{,*/}*.css',
                '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
                '<%= yeoman.app %>/templates/{,*/}*.hbs',
                '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
            ]
        },
        tasks: ['assemble', 'livereload']
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment