Articles in this section
Category / Section

How to resolve css issue with EnableOptimzation in bundle config

1 min read

This knowledge base explains how to resolve the CSS issue with EnableOptimization in bundle config.

Solution:

1. We can achieve this requirement by referring the ej.web.all.min.css file in the BundleConfig when we set the “EnableOptimizations” as true and the file (ej.web.all.min.css) should be added as a separate bundle by applying a CssRewriteUrlTransformation. This will import the CSS file from the individual files.

BundleConfig.cs

 

bundles.Add(new StyleBundle("~/Content/ej").Include(
                     "~/ejThemes/default-theme/ej.widgets.all.min.css", newCssRewriteUrlTransform()
                     ));
 

 

2. If you are not enable “EnableOptimizations” then we suggest you refer “ej.widgets.core.min.css” & “ej.theme.min.css” individual files instead of “ej.web.all.min.css”. Because ej.web.all.min.css” files have been imported from two other css files “ej.wigets.core.min.css” and “ej.theme.min.css”.

BundleConfig.cs

 

 
bundles.Add(new StyleBundle("~/Content/css").Include(
                          ...
 
                 "~/ejThemes/ej.widgets.core.min.css",
                    "~/ejThemes/default-theme/ej.theme.min.css",
                      ...
                      );
 

 

Note:

  1. Please refer this link for more detail regarding CssRewriteUrlTransformation (404 With Relative Paths and the Web Optimization Framework) 
  2. The ej.web.all.min.css file contains ej.theme.min.css and ej.widgets.core.min.css. So, include either ej.web.all.min.css (should be in separate bundle) or include ej.theme.min.css andej.widgets.core.min.css files separately. Set the EnableOptimization as true when refer theej.web.all.min.css file or else remove it. 

 

Result:

Figure 1: Grid Rendering with CSS files referred in bundle config.

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied