Refused to apply style from ... because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled
Asked Answered
P

4

5

I am getting the above error when I host my Drupal site using MAMP. All of my HTML loads, but my CSS is not loading.

Refused to apply style from 'http://mysite/sites/default/files/css/css_Sr-zrzbdXHUuh75RQ_QtqOK_J8ztTYUGygU67gPw.css?f7d7s7' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Patroon answered 21/2, 2018 at 18:38 Comment(2)
how have you added the styling to your webpage?Sphene
They are generated by Drupal. They actually don't exist on my local.Patroon
Y
5

I have a D8 site on pantheon (using a theme) and I was getting this problem when I created my local (using Lando). And the solution for me was to turn off CSS/JS aggregation on my local, then the page loaded fine:

drush -y config-set system.performance css.preprocess 0

drush -y config-set system.performance js.preprocess 0

Youngstown answered 11/4, 2018 at 14:45 Comment(1)
This is a workaround, not a solutionAlmita
P
2

The agregated css are in sites/default/files/css directory.

The problem is the permissions in the files directory, sites/default/files should have 755 and have 750

You can change the permissions with:

chmod 755 sites/default/files
Peeling answered 27/11, 2018 at 15:45 Comment(0)
V
1

Steps to try:

-try to clear all caches

If that doesn't work:

-take a look at settings -> media -> filesytem. On this page you can find your temporary file path. Check if this is the correct path so your Drupal site writes these generated style files to the correct folder.

As you can see, your site is looking for this style file in /sites/default/files/. So this should be the path that is in the 'temporary file path' field.

Veneaux answered 22/2, 2018 at 10:1 Comment(0)
A
0

I fixed my mime problem with the activation of both checkboxes on the drupal performance Page:

/admin/config/development/performance

enter image description here

Allies answered 2/5, 2023 at 11:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.