0

For readability I created my stylesheets like this:

div.icons,div.sizes,div.configs
{
    width:213px;
    float:left;
}

Is it necessary to use this style for performance reasons:

div.icons,div.sizes,div.configs{width:213px;float:left;}

I am using ASP.NET webforms. Can I still use the bundling functionality from ASP.NET MVC for this?

MikeSmithDev
  • 15,731
  • 4
  • 58
  • 89
Pindakaas
  • 4,389
  • 16
  • 48
  • 83

2 Answers2

0

I would not write css or JavaScript with that in mind. Instead I would rely on a minifier to do the job. That way your css files are readable.

TGH
  • 38,769
  • 12
  • 102
  • 135
0

No, you don't need to style it like that for performance reasons. Write it for readability. Bundling and minification will handle the performance part.

Yes, bundling and minification works in Webforms. Here are key steps from the post Adding Bundling and Minification to Web Forms:

Create your bundle:

using System.Web.Optimization;

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));
        //...

Register your bundle: (global.asax)

void Application_Start(object sender, EventArgs e)
{
    BundleConfig.RegisterBundles(BundleTable.Bundles);
    //...

Reference your bundle: (masterpage)

<asp:PlaceHolder runat="server">        
    <%: Scripts.Render("~/bundles/jquery") %>
</asp:PlaceHolder>

Get bundling and minification from NuGet.

MikeSmithDev
  • 15,731
  • 4
  • 58
  • 89