Skip to content

LayoutCssFileAttribute class

namespace: Serenity.Web   assembly: Serenity.Net.Web

Declares a CSS file that should be included in the layout on every page, usually rendered with @Html.LayoutCssFiles(). This is intended for dynamically loaded libraries that need their navigation or layout styles to be available on all pages, without depending on a page specific entry point. The declared files are also exposed as a predefined dynamic bundle named ScriptName, which can be referenced from a bundle definition (e.g. dynamic://CssBundle.LayoutCssFiles). Note that the predefined bundle is generated once and cached, so it does not follow feature toggles dynamically; use @Html.LayoutCssFiles() for that.

[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public class LayoutCssFileAttribute : Attribute

Public Members

name description
LayoutCssFileAttribute(…) Creates a new instance of the attribute.
Order { get; set; } Gets or sets the order among the included files. Files with a lower order are included first. Defaults to 0.
Path { get; } Gets the app relative (~/) CSS file path.
Permission { get; set; } Permission (or permission expression) required to include the file. Default is "*", e.g. everyone including anonymous users, as layout styles are usually needed on pages like the login page too. The file is left out of the layout for users without it, and a bundle with such a file requires the permission too.
RequireAnyFeature { get; set; } Gets or sets a value indicating whether any of the RequireFeatures should be enabled instead of all of them.
RequireFeatures { get; set; } Gets or sets the set of feature toggles this file depends on. When set, the file is only included if all (or any, see RequireAnyFeature) of the features are enabled.

See Also