NuGet package | Owin.Framework.Pages.Html |
GitHub source | OwinFramework.Pages.Html |
You can attach this attribute to elements that produce CSS and Javascript to control how the CSS and Javascript is incorporated into the website.
[IsRegion("menu_region")] [Container("ul", "{ns}_menu")] [ChildContainer("li", "{ns}_menu-item")] [DeployCss("ul.{ns}_menu", "font-size: 14px;")] [DeployCss("li.{ns}_menu-tem", "font-size: 12px;")] [DeployedAs(AssetDeployment.InPage)] public class MenuRegion { }
The [DeployedAs()] attribute has the following properties you can set.
This defines the name of the Module element that defines the asset deployment method for this element's assets. By default elements inherit asset deployment from their parent element. This propagates up the tree to the Page level where the default is to deploy all assets to one resource.
By specifying a module name in this attribute, you are saying that the asset deployment mechanism for this element is going to be determined by the module instead of being explicitly set on this element. This is a good strategy because it allows you to change your mind later about how you want assets deployed without having to revisit all the code.
This allows you to explicitly define the asset deployment mechanism for the element. Generally speaking you probably don't want to explicitly set this for every element, because using modules is a much better way of organizing your assets.
The possible values for the Deployment property are: