Reputation: 1013
ok, that maybe a old question, but i really dont know how to use BundleConfig in website project. not the webform project or mvc project.
i debug the code. it call the BundleConfig's add method. but it not work. something wrong?
this is my code:
add Global.asax in Root
add BundleConfig.RegisterBundles(BundleTable.Bundles) in Application_Start
add BundleConfig.vb class in App_Code
Public Class BundleConfig
Public Shared Sub RegisterBundles(ByVal bundles As BundleCollection)
bundles.Add(New StyleBundle("~/Content/css").Include("~/Content/site.css"))
End Sub
End Class
add Default.aspx
add Content/site.css file.
and something?
OK, i knew what is happend. i put my css file in Content/css/ folder. this line:
bundles.Add(New StyleBundle("~/Content/css").Include("~/Content/css/site.css"))
so it not work. and i change it to
bundles.Add(New StyleBundle("~/whatever/css").Include("~/Content/css/site.css"))
done.
Upvotes: 1
Views: 3486
Reputation: 325
Try registering the bundles in your Global.asax file by adding this line of code:
BundleConfig.RegisterBundles(BundleTable.Bundles);
Examine the Bundle.config file, which contains the markup to create CSS style bundles. You can add your own style bundles. e.g:
<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
<styleBundle path="~/Content/css"><include path="~/Content/Site.css" /></styleBundle>
</bundles>
Now reference it in your page using:
<webopt:BundleReference runat="server" Path="~/Content/css" />
Upvotes: 1