gulp


Gulp Livereload doesn't work


Gulpfile.js doesn't update my browser. I include all necessary plugins.
var gulp = require('gulp'),
concatCss = require('gulp-concat-css'),
minifyCss = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer'),
notify = require('gulp-notify'),
livereload = require('gulp-livereload'),
connect = require('gulp-connect');
//connect server
gulp.task('connect', function() {
connect.server({
root: 'gulp-project',
livereload: true
});
});
//css
gulp.task('css', function() {
return gulp.src('./*.css')
.pipe(concatCss("bundle.css"))
.pipe(minifyCss())
.pipe(autoprefixer({
browsers: ['last 15 versions'],
cascade: false
}))
.pipe(gulp.dest('out/'))
.pipe(notify("Done!"))
.pipe(connect.reload());
});
//html
gulp.task('html', function() {
return gulp.src('index.html')
.pipe(connect.reload());
})
//watch
gulp.task('watch', function() {
gulp.watch('*.css',['css'])
gulp.watch('index.html',['html'])
});
gulp.task('default',['connect','html','css','watch'])
Gulpfile.js doesn't update my browser page.I include all necessary plugins.
Thank you for your answers.
Livereload can be quite a story to set up and I think it changed syntax and call params over versions. What used to work for me in the past was:
var livereload = require('gulp-livereload')();
and then whenever you want to trigger it:
livereload.changed(file.path);
I know it breaks your pipe usage, but there are workarounds to that.
Also check that you do not need to start livereload:
livereload.listen();
This is new in gulp-livereload v 3.x:
gulp-livereload will not automatically listen for changes. You now have to manually call livereload.listen unless you set the option start:
livereload({ start: true })

Related Links

Getting an error when trying to serve the app using browser-sync
Can't Sprite using gulp.spritesmith
How can I make build variables available to all JS files in gulp?
Gulp not installed globally?
gulp-useref deep folders error
use gulp+browserify+reactify, can't emit exit when got a ReactifyError
gulp-browserstack and gulp-cucumber don't seem to play nicely together
Gulp - Babel - EcmaScript-6 - Redux / Unhandled stream error in pipe
Delete all files using gulp except once that match pattern
Gulp task 'inject:vendor' does not inject Bower dependencies
Why do you open a gulp src pipe when you use gulp-watch?
Atom action performed on save
Gulp BrowserSync not working with SCSS
run gulp-clean-css options in gulp-inline
Is it possible to run gulp tasks after linting?
How to male a snapshot/dump from gulp installation and settings?

Categories

HOME
intellij-idea
process
django-middleware
ms-application-insights
mailchimp
python-3.4
handlebars.js
google-my-business-api
virtualenv
drush
javascript-debugger
responsive
google-closure-compiler
ofbiz
android-actionbar
geography
draw2d
legend-properties
conditional-formatting
glibc
bootstrap-datetimepicker
git-branch
waterfall
visual-studio-community
drombler-fx
scripting-language
sphinx4
2checkout
mobile-development
log4net-configuration
spring-oauth2
jcr
powerbi-embedded
ape-phylo
spring-webflow-2
hierarchical-clustering
lucee
openxava
appcmd
intermediate-language
activesupport
r-commander
dmalloc
android-music-player
firebase-job-dispatcher
racket-student-languages
wordpress-plugin
askbot
jsoncpp
autoscaling
minko
perfect-scrollbar
indices
tigase
scjp
yandex-api
xps
farpoint-spread
html5-filesystem
kernel-density
netbeans-plugins
complete
ie-developer-tools
friendly-url
mosix
proj4
http-compression
servicemanager
cloudmade
antixsslibrary
linqdatasource
rfc822
correctness
win-prolog
motorola-droid
umfpack
opendir
norton
activescaffold
nstoolbar
glassfish-embedded
retrospectiva

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App