Answer the question
In order to leave comments, you need to log in
Why doesn't gulp-connect refresh the page when a file changes?
Good day, Friends!
The essence of the problem is this: I configured gulpfile.js, everything works correctly, except that gulp-connect does not want to update the browser page itself. The script inserts into html, it does not give errors. I've tried both with and without the Chrome extension. What can be ideas, what I was wrong?
gulpfile.js
gulp = require 'gulp'
connect = require 'gulp-connect'
jade = require 'gulp-jade'
stylus = require 'gulp-stylus'
coffee = require 'gulp-coffee'
uglify = require 'gulp-uglify'
clean = require 'gulp-clean'
rjs = require 'gulp-requirejs'
gulp.task 'connect', ->
connect.server
port: 1337
livereload: on
root: './dist'
gulp.task 'jade', ->
gulp.src 'src/jade/*.jade'
.pipe do jade
.pipe gulp.dest 'dist'
.pipe do connect.reload
gulp.task 'stylus', ->
gulp.src 'src/stylus/*.styl'
.pipe stylus set: ['compress']
.pipe gulp.dest 'dist/css'
.pipe do connect.reload
gulp.task 'build', ['coffee'], ->
rjs
baseUrl: 'js'
name: '../bower_components/almond/almond'
include: ['main']
insertRequire: ['main']
out: 'all.js'
wrap: on
.pipe do uglify
.pipe gulp.dest 'dist/js'
.pipe do connect.reload
gulp.src 'js/', read:no
.pipe do clean
gulp.task 'coffee', ->
gulp.src 'src/coffee/*.coffee'
.pipe do coffee
.pipe gulp.dest 'js'
.pipe do connect.reload
gulp.task 'watch', ->
gulp.watch 'src/jade/*.jade', ['jade']
gulp.watch 'src/stylus/*.styl', ['stylus']
gulp.watch 'src/coffee/*.coffee', ['build']
gulp.task 'default', ['connect', 'jade', 'stylus', 'build', 'watch']
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question