browsersync没有重新加载?

时间:2016-04-21 01:48:23

标签: javascript gulp browser-sync gulp-watch

我尝试使用browsersync但是在加载页面时我在页面中出现此错误,并且在更改后它没有重新加载。

Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256-0TxGPnyTpqz4fNWqD7/0VtQ8Rrc3/k28BPlYSL7ZCTk='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.

gulp中的代码是



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

// Save a reference to the `reload` method

// Watch scss AND html files, doing different things with each.
gulp.task('serve', function() {

  // Serve files from the root of this project
  browserSync.init({
    server: {
      baseDir: "./"
    }
  });

  gulp.watch("*.html").on("change", reload);
});




0 个答案:

没有答案
相关问题