I'm trying to set up a gulp task which scans my development folder for any new or changed files, and then copies them to my local server with the same folder structure. And it should also do this every time I edit or change a file.
I seem to have something that kinda works, but it's extremely slow up to the point where I don't know if it actually works at all. (The notification message doesn't show up at all after 30+ minutes)
Could someone point in the right direction on how to set this up correctly?
// Server folder
var projectWWW = 'C:/wamp64/www/myproject';
// Files to be copied (everything excluding scss files)
var copySRC = ['./**/*', '!./**/*.{scss}'];
// Require gulp & plugins
var gulp = require('gulp');
var newer = require('gulp-newer');
var notify = require('gulp-notify');
// Copy files task
gulp.task( 'copyFiles', function() {
gulp.src( copySRC )
.pipe( newer( projectWWW ) )
.pipe( gulp.dest( projectWWW ) )
.pipe( notify( { message: 'TASK: "copyFiles" Completed!', onLast: true } ) );
});
// Watch tasks
gulp.task( 'default', ['copyFiles'], function () {
gulp.watch( copySRC, [ 'copyFiles' ] ); // Copy on file changes.
});
i ran the same code on my local for a test app and it works.
var copySRC = ['./**/*', '!./node_modules/**'];