Interfaces

Project

Pages Html

NuGet packageOwin.Framework.Pages.Html
GitHub sourceOwinFramework.Pages.Html

Home |  Readme

[IsModule] attribute | The OWIN Framework Pages

The [IsModule] Attribute

Attach this attribute to a class to identify it as a module.

Example Usage

[IsModule("content", AssetDeployment.InPage)]
internal class ContentModule 
{ }
[IsComponent("defaultStyles")]
[DeployedAs("content")]
internal class DefaultStylesComponent 
{ }

The [IsModule()] attribute has the following properties you can set.

Name

You will want to choose a unique name for your module to make it useful.

AssetDeployment

This defines the asset deployment mechanism to use for all elements assigned to this module.

The possible values for the AssetDeployment property are:

  • Inherit means that page element will interit the AssetDeployment property of the containing page element. If all elements on a page are set to Inherit (which is the default) then they all follow the asset deployment mechanism set in the page. Pages default to PerWebsite, so by default all Javascript and all CSS for the entire website will be combined into a single asset.
  • InPage means that page element will write its CSS and Javascript directly into the <head> section of the page. This option is mainly useful for debugging and generating html for emails.
  • PerPage means that each page will have a Javascript and CSS asset that is specific to that page and contains everything that that page needs to render. If the same page element is used on multiple pages then its CSS and Javascript will be duplicated in all the page specific assets for the pages where it is referenced. This option means that the page will only reference exactly what it needs, but the browser will have to fetch the assets associated with every page that the user visits.
  • PerModule means that the element should use the AssetDeployment property of the module it is in. You can also specify this module by name with the [DeployedAs] attribute.
  • PerWebsite means that there is a single Javascript and CSS asset for the entire website and this element will write its CSS and Javascript into this global asset.