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

gulp-tslint return undefined when required
Gulp watch only runs once
Gulp watch not working with imported files but works with main file
Gulp watch for css doesn't work
Using gulp for compiling of changed files only
How to run gulp task in visual studio code?
BrowserSync with custom URL
Multi-tenancy and Semantic UI
Display total number of errors with Gulp Jshint
Gulp watch entire folder & compile saved file
elixir.queueTask is undefined
gulp : browserify then concat files
parse error on vinyl source stream on gulp browserify babelify project
Bitters error (“Undefined variable: $font-stack-system”)
Gulp Babel Issue Using Foundation
Can gulp-rev inside individual tasks merge into one manifest?

Categories

HOME
kendo-ui-angular2
azure-documentdb
pelican
highmaps
azure-resource-manager
overrides
zabbix
pyodbc
ejb-3.0
runtime
core-data
kairosdb
dynamics-crm-2011
ldap-query
osrm
websharper
captcha
opendaylight
webseal
openscad
pylint
web-parts
udeploy
spring-webflow
summernote
datasource
ecmascript-2017
jira-zephyr
stack-trace
git-submodules
azure-table-storage
spring-data-gemfire
2checkout
choco
webspeech-api
pyenv
mongoid5
stencyl
origami
armadillo
vertical-alignment
vpython
colorbox
django-tables2
fluent-nhibernate-mapping
selection-sort
iban
suitesparse
spring-social-twitter
firebase-job-dispatcher
hfp
android-xmlpullparser
db2-zos
django-celery
audiorecord
camellia
stdlist
alchemy
containstable
dynamics-nav
kramdown
bioconductor
tvp
producer-consumer
libgcrypt
transport
android-togglebutton
borland-c++
eggplant
teamwork
jsonschema2pojo
yosemite
tigase
dirname
fscanf
angular-file-upload
nspopupbutton
rda
slimscroll
svg-android
qgraphicsscene
extensibility
select2-rails
cloudmade
generator-expression
tasklist
netzke
nsscrollview
mvcmailer
datejs
yii-cactiverecord
mcpd
rjs
session-hijacking
jqtransform
http-response-codes
conditional-operator
iphone-maps
database-agnostic
numerical-computing
glassfish-embedded
qlibrary
software-update
urlscan

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