且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Angular 6 - 拒绝应用来自“..."的样式,因为它的 MIME 类型(“text/html")不是受支持的样式表

更新时间:2021-08-24 03:10:56

经过一番挖掘,找到了答案(至少对我有用):

Found the answer (at least worked for me), after some digging around:

看起来像在 Angular 6 中,我们需要将任何外部 CSS(如 bootstrap、fontawesome、Primeng 等)包含到 angular.json 中,如下所示:

Looks like inAngular 6 we need to include any external CSS (like bootstrap, fontawesome, Primeng etc.,) to the angular.json as below:

        "styles": [
          "./node_modules/bootstrap/dist/css/bootstrap.min.css",
          "./node_modules/font-awesome/css/font-awesome.min.css",
          "src/styles.css",
          "./node_modules/primeng/resources/themes/omega/theme.css",
          "./node_modules/primeng/resources/primeng.min.css",
          "./node_modules/primeicons/primeicons.css"
        ],
        "scripts": [
          "./node_modules/jquery/dist/jquery.slim.min.js",
          "./node_modules/popper.js/dist/umd/popper.min.js",
          "./node_modules/bootstrap/dist/js/bootstrap.min.js"
        ]