Bundling Kentico 12 Admin CSS.

Gurupada Giri asked on March 26, 2024 18:17

We are using Kentico 12. All of our Site CSS have been developed in Kentico Admin and we are calling the CSS by the GetResource.ashx handler. below is the sample . <link href="@siteDomainName/CMSPages/GetResource.ashx?stylesheetname=CSSClassName" type="text/css" rel="stylesheet" />

We have developed around 30 widgets, for each widgets we have separate CSS class created in the Admin. For any page if using 5 Widgets , we are binding 5 CSS classes in the page by handler.

Now are trying to Bundle all the Admin CSS files , which are called in the page by the handler. Please suggest how to bundle the CSS files.

Recent Answers


Brenden Kehren answered on March 27, 2024 13:47

I'd highly recommend removing the css from those widgets and placing the css in the main stylesheet with commenting around what widget they are for. This is by far the quickest and simplest solution. Trying to bundle, compile and minimize those database assets will be a nightmare, especially in a version that is no longer supported.

0 votesVote for this answer Mark as a Correct answer

Khan Zain answered on August 23, 2024 08:31

To bundle all the Admin CSS files in Kentico 12, follow these steps:

  1. Create a Bundled CSS File: Combine all widget-specific CSS into a single CSS file. This can be done manually or through build tools like Gulp or Webpack.
  2. Register the Bundled CSS: Replace the individual CSS references in your pages with a reference to the bundled CSS file. This file can be stored in the Kentico file system or served through the handler.
  3. Optimize with Kentico: Use Kentico’s built-in CSS minification and bundling settings (available in the administration panel) to ensure optimized loading.

This approach reduces the number of HTTP requests and improves page performance.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.