666 | | // Add a listener to the watch task. |
667 | | // |
668 | | // On `watch:all`, automatically updates the `copy:dynamic` and `clean:dynamic` |
669 | | // configurations so that only the changed files are updated. |
670 | | // On `watch:rtl`, automatically updates the `rtlcss:dynamic` configuration. |
671 | | grunt.event.on('watch', function( action, filepath, target ) { |
672 | | if ( target !== 'all' && target !== 'rtl' ) { |
| 658 | /* |
| 659 | * Automatically updates the `:dynamic` configurations |
| 660 | * so that only the changed files are updated. |
| 661 | */ |
| 662 | grunt.event.on( 'watch', function( action, filepath, target ) { |
| 663 | var src; |
| 664 | |
| 665 | if ( [ 'all', 'rtl', 'browserify' ].indexOf( target ) === -1 ) { |
676 | | var relativePath = path.relative( SOURCE_DIR, filepath ), |
677 | | cleanSrc = ( action === 'deleted' ) ? [relativePath] : [], |
678 | | copySrc = ( action === 'deleted' ) ? [] : [relativePath]; |
679 | | |
680 | | grunt.config(['clean', 'dynamic', 'src'], cleanSrc); |
681 | | grunt.config(['copy', 'dynamic', 'src'], copySrc); |
682 | | grunt.config(['rtlcss', 'dynamic', 'src'], copySrc); |
683 | | }); |
| 669 | src = [ path.relative( SOURCE_DIR, filepath ) ]; |
| 670 | |
| 671 | if ( action === 'deleted' ) { |
| 672 | grunt.config( [ 'clean', 'dynamic', 'src' ], src ); |
| 673 | } else { |
| 674 | grunt.config( [ 'copy', 'dynamic', 'src' ], src ); |
| 675 | |
| 676 | if ( target === 'rtl' ) { |
| 677 | grunt.config( [ 'rtlcss', 'dynamic', 'src' ], src ); |
| 678 | } |
| 679 | } |
| 680 | } ); |