gulp-community / gulp-concat

Streaming concat middleware for gulp
MIT License
792 stars 126 forks source link

watch .coffee to concat but only run once in windows #73

Closed lin-hun closed 9 years ago

lin-hun commented 9 years ago

var coffee, coffeeSrc, coffeeWatch, concat, directory, exec, gulp, plugins, watch;

gulp = require('gulp');

plugins = (require('gulp-load-plugins'))();

exec = require('child_process').exec;

directory = 'lib-coffee/';

coffeeSrc = [directory + 'settings.coffee', directory + 'utility.coffee', directory + 'player.coffee', directory + 'main.coffee'];

concat = plugins.concat;

coffee = plugins.coffee;

watch = plugins.watch;

coffeeWatch = function() { return gulp.src(coffeeSrc).pipe(concat('main.js')).pipe(gulp.dest('bin/')).on('error', function(err) { return console.log(err); }); };

gulp.task('coffeeWatch', coffeeWatch);

gulp.task('watch', function() { return gulp.watch('lib-coffee/*.coffee', ['coffeeWatch']); });

my code only concat when the watch task init run why ?may the code is wrong?

yocontra commented 9 years ago

Can you format the code and use code blocks?

lin-hun commented 9 years ago
var coffee, coffeeSrc, coffeeWatch, concat, directory, exec, gulp, plugins, watch;

gulp = require('gulp');

plugins = (require('gulp-load-plugins'))();
directory = 'lib-coffee/';

coffeeSrc = [directory + 'settings.coffee', directory + 'utility.coffee', directory + 'player.coffee', directory + 'main.coffee'];

concat = plugins.concat;

coffee = plugins.coffee;

watch = plugins.watch;

coffeeWatch = function () {
    return gulp.src(coffeeSrc).pipe(concat('main.js')).pipe(gulp.dest('bin/')).on('error', function (err) {
        return console.log(err);
    });
};

gulp.task('coffeeWatch', coffeeWatch);

gulp.task('watch', function () {
    return gulp.watch('lib-coffee/*.coffee', ['coffeeWatch']);
});