Luis Delgado
Luis Delgado

Reputation: 3734

CSS ignored when deploying MVC5 project to Azure

I have developed a website on MVC5 and deployed it to Azure websites. The site works as expected but on browsing to the website hosted in Azure, the site ignores the changes I have made to the default bootstrap.css file. This file is set as "Copy Always" to the output directory, so it is present in Azure as well with the rest of the code.

Refreshing the browser does not show the website as it should be displayed. Neither does restarting the azure website help. Below is my code:

Site.master

<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />       
<title>Title</title>

<asp:PlaceHolder runat="server">
    <%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:bundlereference runat="server" path="~/Content/css" />        
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />

</head>
<body>
*Rest of default Site.Master file*

Bundle.config

<bundles version="1.0">
    <styleBundle path="~/Content/css">
        <include path="~/Content/bootstrap.css" />
        <include path="~/Content/Site.css" />
    </styleBundle>
</bundles>

Upvotes: 4

Views: 3003

Answers (2)

tzup
tzup

Reputation: 3604

If you modified bootstrap.css you need to update the minified version bootstrap.min.css as well.

You can do that easily at: cssminifier.com

For details on how to update the minified version, check out this question

Upvotes: 1

Luis Delgado
Luis Delgado

Reputation: 3734

Workaround found

I managed to get the behavior I am expecting by doing the following. Might not be the best approach, but it is functional and I can't see any major flaws on it.

On Site.Master, replace this line:

   <webopt:bundlereference runat="server" path="~/Content/css" />

with these ones:

<link href="~/Content/bootstrap.css" rel="stylesheet" type="text/css" runat="server" />
<link href="~/Content/Site.css" rel="stylesheet" type="text/css" runat="server" />

Upvotes: 2

Related Questions