S
S
Splashed2016-05-31 18:01:12
Node.js
Splashed, 2016-05-31 18:01:12

How to run gulp with livereload and opn?

The problem is this, I install npm install --save-dev gulp gulp-connect opn I write in gulpfile.js but after calling gulp it displays gulp: command not found
(I did everything according to the video on loftschool) here is the project itself https://github.com/ kovaldn/dz-port
is my gulpfile.js

var gulp = require("gulp"),
  connect = require("gulp-connect"),
  opn = require("opn");

gulp.task('connect', function() {
  connect.server({
    root: 'app',
    livereload: true,
    port: 8888
  });
  opn('http://localhost:8888');
});

gulp.task('html', function () {
  gulp.src('./app/*.html')
    .pipe(connect.reload());
});

gulp.task('css', function () {
  gulp.src('./app/css/*.css')
    .pipe(connect.reload());
});

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

gulp.task('watch', function () {
  gulp.watch(['./app/*.html'], ['html']);
  gulp.watch(['./app/css/*.css'], ['css']);
  gulp.watch(['./app/js/*.js'], ['js']);
});

gulp.task('default', ['connect', 'watch']);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
zooks, 2016-05-31
@Splashed

gulp-livereload is not working right now. Use gulp-refresh .

Y
Yuri Kucherenko, 2016-05-31
@litlleidiot

Use browser-sync
npm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question