docs/en/modules/cms-kit/global-resources.md
//[doc-seo]
{
"Description": "Learn how to dynamically manage global styles and scripts in CMS Kit, enabling features for seamless development with ABP Framework."
}
CMS Kit Global Resources system allows to add global styles and scripts dynamically.
By default, CMS Kit features are disabled. Therefore, you need to enable the features you want, before starting to use it. You can use the Global Feature system to enable/disable CMS Kit features on development time. Alternatively, you can use the ABP's Feature System to disable a CMS Kit feature on runtime.
Check the "How to Install" section of the CMS Kit Module documentation to see how to enable/disable CMS Kit features on development time.
CMS Kit module admin side adds the following items to the main menu, under the Global Resources menu item:
CmsKitAdminMenus class has the constants for the menu item names.
Global Resources page is used to manage global styles and scripts in the system.
The built-in public web module adds the style resource at LayoutHooks.Head.Last and the script resource at LayoutHooks.Body.Last. The resources are served from /cms-kit/global-resources/style and /cms-kit/global-resources/script. A cache miss stores the loaded resource in the distributed cache with a two-minute absolute expiration. Updating an existing resource refreshes its cached value through a local entity event and uses the configured default cache options.
Global resources are trusted administrator input. The style is returned as CSS and the script is returned as executable JavaScript on every public page that uses the layout hooks. Grant
CmsKit.GlobalResourcesonly to users who are allowed to execute code in visitors' browsers, and apply your Content Security Policy accordingly.
This module follows the Entity Best Practices & Conventions guide.
GlobalResource (aggregate root): Stores a resource.This module follows the Repository Best Practices & Conventions guide.
Following custom repositories are defined for this feature:
IGlobalResourceRepositoryThis module follows the Domain Services Best Practices & Conventions guide.
GlobalResourceManager is used to perform operations for the GlobalResource aggregate root.
GlobalResourceAdminAppService (implements IGlobalResourceAdminAppService): Implements the management operations of global resources system.GlobalResourcePublicAppService (implements IGlobalResourcePublicAppService): Implements the public use cases of global resources system.