Grunt-sync
A grunt task to keep directories in sync.
It is very similar to grunt-contrib-copy but
tries to copy only those files that has actually changed.
Usage
npm install grunt-sync --save
Within your grunt file:
grunt.initConfig({
sync: {
main: {
files: [{
cwd: 'src',
src: [
'**',
'!**/*.txt'
],
dest: 'bin',
}],
ignoreInDest: "**/*.js",
verbose: true
}
}
});
grunt.loadNpmTasks('grunt-sync');
grunt.registerTask('default', 'sync');
More examples
sync: {
main: {
files: [
{src: ['path/**'], dest: 'dest/'},
{cwd: 'path/', src: ['**/*.js', '**/*.css'], dest: 'dest/'},
],
verbose: true,
pretend: true,
updateOnly: true
}
}
Changelog
- 0.1.0 - Files missing that are not in
src
are deleted from dest
(unless you specify updateOnly
)
TODO
Research if it's possible to have better integration with grunt-contrib-watch
- update only changed files instead of scanning everything.