JustLearning JustLearning - 2 months ago 8
ASP.NET (C#) Question

Asp css bundling and minification not woring

I have setup my css bundling and minification as follows:

bundles.Add(new StyleBundle("~/styles").Include(
"~/Content/bootstrap.css",
"~/Content/jBox.css"
));
BundleTable.EnableOptimizations = true;


and
aspx
page:

<%: System.Web.Optimization.Styles.Render("~/styles") %>


My debug is set to true.

So the above
css
files are never minified and bundled all i get on the client is a response of the actual
aspx
page.(From the console:

http://localhost:25509/styles?v=u2-34wMvMx9Wilp6mlMRpN4LuNH9u4ss_wvYmapLmQ1
)

I cannot figure out with it is not working.

The funny thing is that the
.js
is being bundle correctly and minified

Any ideas?

Answer

Okay i got it to work, don't really understand why it is working. So my css is in a Content folder, I thought virtual directory can be anything thus i used the styles virtual directory. However, once i used ~/Content/css as virtual directory it worked