配置gulp + browser-sync + php 環境

最終發現browser-sync須要你的頁面裏有body標籤,而我新建的index.php沒帶,致使watch不起做用。php

https://github.com/BrowserSyn...css

最後下面這個文檔做爲備份html

var gulp        = require('gulp'),
    browserSync = require('browser-sync').create(),
    reload      = browserSync.reload;

// 靜態服務器
gulp.task('default', function() {
    browserSync.init({
        server: {
            baseDir: "./"
        }
    });

    gulp.watch(['*.html', '*.css', '*.js']).on('change', reload);
});

//代理服務器
gulp.task('php', function() {
    browserSync.init({
        proxy: "http://localhost:63342/responsive"
    });

    gulp.watch('*.php').on('change', reload);
});
相關文章
相關標籤/搜索