tasks/simple_watch.js
function fileChanged(status, filepath) {
			// If file was deleted and then re-added, consider it changed.
			if (changedFiles[filepath] === 'deleted' && status === 'added') {
				status = 'changed';
			}
			// Keep track of changed status for later.
			changedFiles[filepath] = status;
			// Emit watch events if anyone is listening
			if (grunt.event.listeners('watch').length > 0) {
				var matchingTargets = [];
				targets.forEach(function(target) {
					if (grunt.file.match(target.files, filepath).length > 0) {
						matchingTargets.push(target.name);
					}
				});
				matchingTargets.forEach(function(matchingTarget) {
					grunt.event.emit('watch', status, filepath, matchingTarget);
				});
			}
			// Keep track of changed status for later.
			changedFiles[filepath] = status;
			// Execute debounced done function.
			done();
		}
function fileChanged(status, filepath) {
			// If file was deleted and then re-added, consider it changed.
			if (changedFiles[filepath] === 'deleted' && status === 'added') {
				status = 'changed';
			}
			// Keep track of changed status for later.
			changedFiles[filepath] = status;
			// Emit watch events if anyone is listening
			if (grunt.event.listeners('watch').length > 0) {
				var matchingTargets = [];
				targets.forEach(function(target) {
					if (grunt.file.match(target.files, filepath).length > 0) {
						matchingTargets.push(target.name);
					}
				});
				matchingTargets.forEach(function(matchingTarget) {
					grunt.event.emit('watch', status, filepath, matchingTarget);
				});
			}
			// Keep track of changed status for later.
			changedFiles[filepath] = status;
			// Execute debounced done function.
			done();
		}
function fileChanged ( status , filepath ) { // If file was deleted and then re-added, consider it changed. if ( changedFiles [ filepath ] === 'deleted' && status === 'added' ) { status = 'changed' ; } // Keep track of changed status for later. changedFiles [ filepath ] = status ; // Emit watch events if anyone is listening if ( grunt . event . listeners ( 'watch' ) . length > 0 ) { var matchingTargets = [ ] ; targets . forEach ( function ( target ) { if ( grunt . file . match ( target . files , filepath ) . length > 0 ) { matchingTargets . push ( target . name ) ; } } ) ; matchingTargets . forEach ( function ( matchingTarget ) { grunt . event . emit ( 'watch' , status , filepath , matchingTarget ) ; } ) ; } // Keep track of changed status for later. changedFiles [ filepath ] = status ; // Execute debounced done function. done ( ) ; }
Handle file changes.
Handle file changes .