Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with livereload #91

Closed
lgg opened this issue Sep 6, 2015 · 1 comment
Closed

Trouble with livereload #91

lgg opened this issue Sep 6, 2015 · 1 comment

Comments

@lgg
Copy link

lgg commented Sep 6, 2015

I have win7, git bash && chrome.
gulpfile.js:

var gulp  = require('gulp'),
    livereload = require('gulp-livereload');


gulp.task('reload', function() {
    gulp.pipe(livereload());
});

// Watch Files For Changes
gulp.task('watch', function() {
    livereload.listen();
    gulp.watch('web/js/*.js', ['reload']);
    gulp.watch('web/css/*.css', ['reload']);
});

// create a default task and just log a message
gulp.task('default', ['watch']);

result in console(start gulp and then change .js file:

$ gulp
[16:36:58] Using gulpfile d:\development\web\projects\tasks.php\gulpfile.js
[16:36:59] Starting 'watch'...
[16:36:59] Finished 'watch' after 74 ms
[16:36:59] Starting 'default'...
[16:36:59] Finished 'default' after 28 μs
[16:37:02] Starting 'reload'...
[16:37:02] 'reload' errored after 1.66 ms
[16:37:02] TypeError: undefined is not a function
    at Gulp.<anonymous> (d:\development\web\projects\tasks.php\gulpfile.js:6:10)

    at module.exports (C:\Users\Фёдор\AppData\Roaming\npm\node_modules\gulp\node
_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (C:\Users\Фёдор\AppData\Roaming\npm\node_modul
es\gulp\node_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (C:\Users\Фёдор\AppData\Roaming\npm\node_modul
es\gulp\node_modules\orchestrator\index.js:214:10)
    at Gulp.Orchestrator.start (C:\Users\Фёдор\AppData\Roaming\npm\node_modules\
gulp\node_modules\orchestrator\index.js:134:8)
    at Gulp.<anonymous> (C:\Users\Фёдор\AppData\Roaming\npm\node_modules\gulp\in
dex.js:36:18)
    at Gaze.<anonymous> (C:\Users\Фёдор\AppData\Roaming\npm\node_modules\gulp\no
de_modules\vinyl-fs\node_modules\glob-watcher\index.js:18:14)
    at Gaze.emit (events.js:110:17)
    at Gaze.emit (C:\Users\Фёдор\AppData\Roaming\npm\node_modules\gulp\node_modu
les\vinyl-fs\node_modules\glob-watcher\node_modules\gaze\lib\gaze.js:129:32)
    at C:\Users\Фёдор\AppData\Roaming\npm\node_modules\gulp\node_modules\vinyl-f
s\node_modules\glob-watcher\node_modules\gaze\lib\gaze.js:415:16

What i'm doing wrong?

@lgg
Copy link
Author

lgg commented Sep 6, 2015

Sorry. It's my fault.
Correct gulpfile:

var gulp  = require('gulp'),
    livereload = require('gulp-livereload');

gulp.task('reload', function() {
    gulp.src('web/js/*.js').pipe(livereload());
});

// Watch Files For Changes
gulp.task('watch', function() {
    livereload.listen();
    gulp.watch('web/js/*.js', ['reload']);
    gulp.watch('web/css/*.css', ['reload']);
});

// create a default task and just log a message
gulp.task('default', ['watch']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant