Magento – Magento 2 : Refuse to apply style

cssmagento2theme

I have this error :

Refused to apply style from
'http://www.portailclient-dev.com/pub/static/version1528816010/frontend/My/Theme/fr_FR/css/custom-m.css'
because its MIME type ('text/plain') is not a supported stylesheet
MIME type, and strict MIME checking is enabled.

In my default_head_blocks.xml, I have this (my theme extends luma) :

<head>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <css src="mage/calendar.css"/>
        <css src="css/custom-m.css"/>
        <script src="requirejs/require.js"/>
        <css src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css" src_type="url" />
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" src_type="url" />
    </head>

I do i fix this?

EDIT

The solution :

change <css src="css/custom-m.css"/>
to <css src="Magento_Theme::css/custom-m.css"/>

Best Answer

There could be 2 reasons

  1. Your theme is not deployed for specific store view. You can try to deploy the theme for that specific store view like this

php bin/magento setup:static-content:deploy fr_FR -f

  1. Please check and insure that you have .htaccess file in your pub/static/ folder. Also if you are working on Linux please check the file permission.
Related Topic