gulp服务器文件没有更新,gulp无法热更新!!!

`这是我的gulp配置

var gulp = require('gulp');

var $ = require('gulp-load-plugins')();

var open = require('open');

var app = {

srcPath: 'src/',

devPath: 'build/',

prdPath: 'dist/'

}

gulp.task('lib',function(){

gulp.src('bower_components/**/*.js')//读取bower_components的文件

.pipe(gulp.dest(app.devPath + 'vendor'))

.pipe(gulp.dest(app.prdPath + 'vendor'))

.pipe($.connect.reload());

})

gulp.task('html',function(){

gulp.src(app.srcPath + '**/*.html')

.pipe(gulp.dest(app.devPath))

.pipe(gulp.dest(app.prdPath))

.pipe($.connect.reload());

})

gulp.task('json',function(){

gulp.src(app.srcPath + 'data/**/*.json')

.pipe(gulp.dest(app.devPath + 'data'))

.pipe(gulp.dest(app.prdPath + 'data'))

.pipe($.connect.reload());

})

gulp.task('less', function(){

gulp.src(app.srcPath + 'style/index.less')

.pipe($.less())

.pipe(gulp.dest(app.devPath + 'css'))

.pipe($.cssmin())

.pipe(gulp.dest(app.prdPath + 'css'))

.pipe($.connect.reload());

})

gulp.task('js',function(){

gulp.src(app.srcPath + 'script/**/*.js')

.pipe($.concat('index.js'))

.pipe(gulp.dest(app.devPath + 'js'))

.pipe($.uglify())

.pipe(gulp.dest(app.prdPath + 'js'))

.pipe($.connect.reload());

})

gulp.task('image', function(){

gulp.src(app.srcPath + 'image/**/*')

.pipe(gulp.dest(app.devPath + 'image'))

.pipe($.imagemin())

.pipe(gulp.dest(app.prdPath + 'image'))

.pipe($.connect.reload());

})

gulp.task('build',['image','js','less','lib','html','json'])

gulp.task('serve', ['build'], function(){

$.connect.server({

root: [app.devPath],

livereload: true,

port:1234

});

open('http://localhost:1234');

gulp.watch('bower_components/**/*', ['lib']);

gulp.watch(app.srcPath + 'script/**/*.js', ['js']);

gulp.watch(app.srcPath + '**/*.html', ['html']);

gulp.watch(app.srcPath + 'data/**/*.json', ['json']);

gulp.watch(app.srcPath + 'style/**/*.less', ['less']);

gulp.watch(app.srcPath + 'script/**/*.js', ['js']);

gulp.watch(app.srcPath + 'image/**/*', ['image']);

})

gulp.task('clean', function(){

gulp.src([app.devPath, app.prdPath])//清空两个目录

.pipe($.clean())

})

//默认执行serve任务

gulp.task('default',['serve']);

这是我的目录结构

bVXxcv?w=175&h=354

像修改了js或者html之类的文件这里有提示,但是页面却未更新

这是怎么回事?

bVXxcG?w=561&h=128

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值