Rock

Rock

  • NA
  • 27
  • 588

How to optimize css files in c#

Apr 29 2019 3:04 AM
I have two css file i.e css1 and css2
 
CSS1.css
  1. body {  
  2. font-size:larger;  
  3. color:darkred;  
  4. margin-left15px;  
  5. }  
And CSS2.css
  1. body {  
  2. color:red;  
  3. margin-bottom100px;  
  4. }  
And, using this bundling configuration:
bundles.Add(new StyleBundle("~/Content/cssTest").Include(
"~/Content/Css1.css",
"~/Content/Css2.css"));
BundleTable.EnableOptimizations = true;
Getting result
  1. body {  
  2. font-size:larger;  
  3. color:darkred;  
  4. margin-left15px;  
  5. }  
  6. body {  
  7. color:red;  
  8. margin-bottom100px;  
  9. }
Expected result
  1. body {  
  2. font-size:larger;  
  3. color:red;  
  4. margin-left15px;  
  5. margin-bottom100px;  
  6. }  

Answers (2)