Skip to content

LayoutScriptFileAttribute class

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

Declares a JS file that should be included in the layout on every page, usually rendered with @Html.LayoutScriptFiles(). This is intended for dynamically loaded libraries that need their scripts 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://Bundle.LayoutScriptFiles). Note that the predefined bundle is generated once and cached, so it does not follow feature toggles dynamically; use @Html.LayoutScriptFiles() for that.

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

Public Members

name description
LayoutScriptFileAttribute(…) 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 (~/) JS file path.
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