Search code examples
htmlcssasp.netbundleweb-optimization

ASP.Net Bundle CSS style


I'm trying to make the bundle for all my stylesheets in a WebForm website. I've succesfully bundled all the scripts but CSS is giving me problem.

this is the bundle.config:

<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
  <styleBundle path="~/_css/BaseSite">
    <include path="~/_css/bootstrap.min.css" />
    <include path="~/_css/AdminLTE.css" />
    <include path="~/_css/Admin_all-skins.css" />
    <include path="~/_css/Site_Custom.css" />
    <include path="~/_css/bootstrap-select.min.css" />
  </styleBundle>
</bundles>

and I call the bundle in the head of the .aspx page this way:

<webopt:bundlereference runat="server" path="~/_css/BaseSite" />

it renders in:

    <link href="/_css/BaseSite" rel="stylesheet"/>

but no style is loaded. If I click on /_css/BaseSite I get a 404 compilation debug is set to false.

where I'm wrong?


Solution

  • Solved by adding

    <add name="BundleModule" type="System.Web.Optimization.BundleModule" />
    

    in the web.config to modules in system.webServer