Skip to content

Instantly share code, notes, and snippets.

@ArnonEilat
Created February 6, 2016 12:50
Show Gist options
  • Save ArnonEilat/64dcbcdf80549222af2e to your computer and use it in GitHub Desktop.
Save ArnonEilat/64dcbcdf80549222af2e to your computer and use it in GitHub Desktop.
Watch files for changes and copy to other destination
var pathToWatch = 'C:\\Users\\Arnon\\Downloads\\'; // Exploit!!
var copyTo = 'C:\\Users\\Arnon\\Desktop\\tst';
module.exports = function(grunt) {
/**
* Initialize grunt
*/
grunt.initConfig({
watch: {
files: pathToWatch + '**',
tasks: ['sync:main']
},
sync: {
main: {
files: [{
cwd: pathToWatch,
src: ['./**'],
dest: copyTo
}],
pretend: false,
verbose: true,
failOnError: true,
updateAndDelete: true
}
}
});
grunt.registerTask('default', [
'sync:main',
'watch'
]);
grunt.loadNpmTasks('grunt-sync');
grunt.loadNpmTasks('grunt-contrib-watch');
};
{
"name": "watch-and-sync",
"version": "1.0.0",
"description": "Copy files whenever they change.",
"author": "Arnon Eilat",
"license": "ISC",
"dependencies": {
"grunt": "^0.4.5",
"grunt-contrib-watch": "^0.6.1",
"grunt-sync": "^0.5.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment