Browsersync重新加载页面而不是注入css

时间:2016-07-28 17:20:00

标签: laravel laravel-5 laravel-5.2 browser-sync laravel-elixir

所以在我之前的问题得到解决之后,我现在面对的是另一个问题。我使用Browsersync来监视文件更改,它运行正常,但不是注入css更改,它会在我的css文件发生更改时实现整个页面。

这是我的gulpfile:

var elixir = require('laravel-elixir');
var gulp = require('gulp');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(function(mix) {
    mix.sass('comingsoon/soon.scss', 'public/assets/comingsoon/css/soon.css')
        .scripts('comingsoon/soon.js', 'public/assets/comingsoon/js/soon.js')
        .browserSync({
            files: [
                'app/*.*',
                'app/**/*.*',
                'public/assets/**/*.*'
            ],

            open: 'external',
            proxy: 'gate7.dev:81',
            host: 'gate7.dev',
            port: 80,
            notify: false
    });
});

1 个答案:

答案 0 :(得分:0)

想出来。我必须具体说明文件'扩展。

var elixir = require('laravel-elixir');
var gulp = require('gulp');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(function(mix) {
    mix.sass('comingsoon/soon.scss', 'public/assets/comingsoon/css/soon.css')
        .scripts('comingsoon/soon.js', 'public/assets/comingsoon/js/soon.js')
        .browserSync({
            files: [
                'app/*.*',
                'app/**/*.*',
                'public/assets/**/*.css',
                'public/assets/**/*.js'
            ],

            open: 'external',
            proxy: 'gate7.dev:81',
            host: 'gate7.dev',
            port: 80,
            notify: false
    });
});