BrowserSync / gulp-browser-sync

How to use the Browsersync module with gulp.
http://browsersync.io
384 stars 27 forks source link

Set encoding header for served js files #23

Closed yantakus closed 10 years ago

yantakus commented 10 years ago

I have a problem with encoding of .js file served by built-in server. How can I set the Content-type header to UTF-8?

I found https://github.com/luics/connect-header, but can you help me to set it up?

I tried this:

var connect = require('connect');
var app = connect();
var header = require('connect-header');

function setContentType(){
    app.use(header({
        'Content-type':'UTF-8'
    }));
}

  browserSync.init(files, {
    server: {
      middleware: [
          setContentType
      ]
    }
  });

But server just hangs, when I call gulp serve (browser page opens, but nothing appears, just loading forever).

Thank you!

shakyShane commented 10 years ago

Did it turn out to not be an issue?

yantakus commented 10 years ago

Yes, my issue turned out to be not with encoding.

shakyShane commented 10 years ago

Ok cool - thanks for closing :)