Same problem here. Resolved in setting BundleTable.EnableOptimizations to false
Refused to apply style from <URL> because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled
HI Team,
I'm trying to to bundling CSS files after minification. My application is ASP.net Core 4.5 not MVC. I have created bungleconfig class file and written below code
public class bundleconfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new StyleBundle("~/bundles/css").Include(
"~/Content/bootstrap.min.css",
"~/Content/main.min.css",
"~/Content/theme.min.css",
"~/Content/bootstrap-select.min.css",
"~/Content/bootstrap-slider.min.css",
"~/Content/bootstrap-theme.min.css",
"~/Content/bootstrap-treeview.min.css",
"~/Content/bootstrap-datetimepicker.min.css",
"~/Content/buttons.dataTables.min.css",
"~/Content/dataTables.bootstrap.min.css",
"~/Content/jquery-ui.min.css",
"~/Content/bootstrap-treeview.min.css"
)
);
BundleTable.EnableOptimizations = true;
}
}
in Main.Maste I added below code in head tag
<%: System.Web.Optimization.Styles.Render("~/bundles/css") %>
After running code MY css is not bundled and nothing applied as well. Getting error
Refused to apply style from <URL> because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Please help
Thanks In advance
2 answers
Sort by: Newest
-
-
Yijing Sun-MSFT 7,071 Reputation points
2021-05-14T07:59:41.957+00:00 Hi @Avbl Sundari ,
I think the MIME Type error could be due to the css path not being correct. How do add css file in your page? You could check it. And you could try use absolute path.
Best regards,
Yijing Sun
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.