1

I'm using grunt-contrib-connect and grunt-contrib-watch for the live reload feature, like so:

watch: {
  options: {
    livereload: true,
  },
  files: ['src/**/*'],
  tasks: ['dev']
},
connect: {
  server: {
    options: {
      port: 8000,
      base: './dist',
      hostname: '0.0.0.0',
      protocol: 'http',
      livereload: true,
      open: true,
    }
  }
},

It works great, but every time I save a css file, I get this error from Chrome:

Refused to apply style from 'http://localhost:8000/section-featured-work/mod-mobile-design.css?livereload=1533148529995' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Is there a way to specify the MIME type to the script that loads the CSS files?

I do not believe this is a duplicate of stackoverflow.com/questions/48248832/, as I believe this is specific to grunt-config and grunt-watch livereload. The CSS is loaded with JavaScript. So how can I fix this for those packages?

By the way, the styles seem to load anyways, but I do not allow runtime errors of any sort in my builds, if at all avoidable.

BBaysinger
  • 5,495
  • 11
  • 51
  • 102

0 Answers0