Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bundling and Minifying Issues

Status
Not open for further replies.

koklimabc

Programmer
Jun 17, 2013
49
MY
I'm quite new to the world of ASP.NET and having some sort of problem in handling as per topics.

I'm currently using VS 2013 (commersial version) but found difficulty to catch up on these techniques for Minifying issues.I'm develop some practice through normal ASP.NET but not MVC type of Web Application Project.

- In "App_Start", I've created 'BundleConfig.cs',

Code:
[indent]public class BundleConfig
{
            public static void RegisterBundles(BundleCollection bundles)
            {
                    bundles.Add(new ScriptBundle("~/Styles/css").Include("~/Styles/Test1.css",
                       "~/Styles/Test2.css")
            );
           BundleTable.EnableOptimizations = true;
}[/indent]
-The Content of Test1.css and Test2.css I've been created,

Code:
h1
{
text-decoration: underline;
}

h1
{
color : red;
}

-Then in my "global.asax"

Code:
[indent]protected void Application_Start(object sender, EventArgs e)
{
              BundleConfig.RegisterBundles(BundleTable.Bundles);
}[/indent]
-In my 'default.aspx' markup view, neither of both belows are totally not working.

[indent]<head runat="server">
<title></title>

<link href='<%= System.Web.Optimization.Styles.Render("Styles/css") %>' rel="stylesheet" />

</head>
[/indent]
-or,

Code:
[indent]<head runat="server">
<title></title>

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

</head>[/indent]

Can anyone one else guide me on how to bring this above coding to work ?
 
My problem, suppose style not script.

bundles.Add(new StyleBundle("~/Styles/css").Include("~/Styles/Test1.css",
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top