Stylesheet not loaded because of MIME-type

前端 未结 30 2909
猫巷女王i
猫巷女王i 2020-11-22 07:29

I\'m working on a website that uses gulp to compile and browser sync to keep the browser synchronised with my changes.

The gulp task compiles everything

30条回答
  •  情深已故
    2020-11-22 07:50

    If you are setting Styles in JavaScript as:

        var cssLink = document.createElement("link");
        cssLink.href = "./content.component.scss";
        cssLink.rel = "stylesheet";
       --> cssLink.type = "html/css";
        (iframe as HTMLIFrameElement).contentDocument.head.appendChild(cssLink);
    

    Then just change cssLint.type (denoted by arrow in above description) to "MIME":

       cssLink.type = "MIME";
    

    It will help you to get rid of the error.

提交回复
热议问题