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

How to inject bower dependencies in karma.conf.js file with gulp?
Getting Libsass Gulp Susy to work together
Gulp compass without config.rb
gulp-webserver: Default to index.html if available, else show directories
gulp-uglify notify on failing build
Declaring optional dependencies
gulp html minification error
Can an IIFE be added to a browserify bundle?
Gulp: Error Messages and Notifications with Plumber
Gulp - gulp-load-plugins not working
How to configure Gulp task to copy bower resources
gulp-jscs doesn't output anything when used in gulp-watch pipeline
ES6 project does not compile because modules not found
Gulp - can't set multiple relative destinations
Deploy a Yeoman Application With Gulp
Gulp-Inject Positions

Categories

HOME
autohotkey
google-cloud-pubsub
weblogic
azure-eventhub
x509certificate
ms-application-insights
artifactory
symfony-sonata
confluence-rest-api
qt4
wkhtmltopdf
normals
sha1
openstack-horizon
google-closure-compiler
jsfiddle
k-means
taxonomy
internet-explorer-7
legend-properties
bootstrap-datetimepicker
react-jsx
rndis
tcpdf
pushbullet
aws-iot
ppp
utc
multiple-inheritance
typeclass
jbossfuse
spring-data-gemfire
directions
ports
eclipse-jdt
ilog
sampling
gstreamer-1.0
dotnetnuke-module
idea-plugin
keychain
ape-phylo
java-5
servicebus
angular-fullstack
hdpi
jcs
cancan
photoshop-script
htop
cc
petapoco
qt3d
vertex-shader
diameter-protocol
web-optimization
android-progressbar
ideavim
jersey-test-framework
nslocalizedstring
overlapping
android-contentresolver
mojolicious
self-join
playn
vectordrawable
fileinputstream
tinymce-plugins
screen-lock
autopep8
touch-typing
jsonschema2pojo
nsmutableurlrequest
cvi
nomachine
logo-lang
mahara
octokit
cab
jython-2.5
qmainwindow
nsregularexpression
junit-rule
m3u
motorola-droid
sqlbuddy
clgeocoder
rjs
designated-initializer
nbehave
cpack
miniport
qprocess
hp-trim
dgml

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