Class ClientResources

Helper methods to require and render client resources.

Inheritance
System.Object
ClientResources
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Framework.Web.Resources
Assembly: EPiServer.Framework.dll
Version: 8.11.0
Syntax
public static class ClientResources

Methods

GetEmbeddedResourceUrl(Type, String)

Gets the embedded resource URL.

Declaration
public static Uri GetEmbeddedResourceUrl(Type type, string resourcePath)
Parameters
Type Name Description
System.Type type

The type belonging to an assembly containing embedded resource.

System.String resourcePath

The resource path.

Returns
Type Description
System.Uri

A string with url to embedded resource

Remarks

This method is a workaround for getting embedded resource URLs in MVC

Render(ClientResource)

Renders a html tag for the specific resource

Declaration
public static string Render(ClientResource resource)
Parameters
Type Name Description
ClientResource resource

The resource to render.

Returns
Type Description
System.String

A script html tag or css html tag

RenderRequiredResources(String)

Renders the required client resources for specified area.

Declaration
public static string RenderRequiredResources(string renderingArea)
Parameters
Type Name Description
System.String renderingArea

The rendering area.

Returns
Type Description
System.String

RenderResources(String)

Renders client resources with specified name.

Declaration
public static string RenderResources(string name)
Parameters
Type Name Description
System.String name

The name of the client resources.

Returns
Type Description
System.String

RenderResources(String, ClientResourceType[])

Renders client resources with specified name and type.

Declaration
public static string RenderResources(string name, ClientResourceType[] resourceTypes)
Parameters
Type Name Description
System.String name

The name of the client resources.

ClientResourceType[] resourceTypes

Only render resources for these types.

Returns
Type Description
System.String

Require(ClientResource)

Requires the specified client resource.

Declaration
public static ClientResourceSettings Require(ClientResource clientResource)
Parameters
Type Name Description
ClientResource clientResource

The client resource.

Returns
Type Description
ClientResourceSettings

Require(String)

Requires the client resource with specified name.

Declaration
public static ClientResourceSettings Require(string name)
Parameters
Type Name Description
System.String name

The name.

Returns
Type Description
ClientResourceSettings

Require(String, String, String, ClientResourceType, IEnumerable<String>, Int32, Boolean)

Requires the client resource with specified properties.

Declaration
public static ClientResourceSettings Require(string path, string inlineContent, string name, ClientResourceType resourceType, IEnumerable<string> dependencies, int sortIndex, bool isMinified)
Parameters
Type Name Description
System.String path

The client resource virtual path path or URL.

System.String inlineContent

Content of the inline client resource that does not reference any path.

System.String name

The client resource name.

ClientResourceType resourceType

The client resource type.

System.Collections.Generic.IEnumerable<System.String> dependencies

The names of other client resources that this resource depends on.

System.Int32 sortIndex

Sort index for this client resource within the group with the same name.

System.Boolean isMinified

Indicates whether the content of the client resource is minified.

Returns
Type Description
ClientResourceSettings

RequireHtmlInline(String)

Requires the inline HTML injection.

Declaration
public static ClientResourceSettings RequireHtmlInline(string inlineContent)
Parameters
Type Name Description
System.String inlineContent

Inline injection content.

Returns
Type Description
ClientResourceSettings

RequireHtmlInline(String, String, IEnumerable<String>)

Requires the inline HTML injection.

Declaration
public static ClientResourceSettings RequireHtmlInline(string inlineContent, string name, IEnumerable<string> dependencies)
Parameters
Type Name Description
System.String inlineContent

Inline injection content.

System.String name

The client resource name.

System.Collections.Generic.IEnumerable<System.String> dependencies

The names of other client resources that this resource depends on.

Returns
Type Description
ClientResourceSettings

RequireScript(String)

Requires the JavaScript resource with specified path.

Declaration
public static ClientResourceSettings RequireScript(string scriptPath)
Parameters
Type Name Description
System.String scriptPath

The script resource virtual path path or URL.

Returns
Type Description
ClientResourceSettings

RequireScript(String, String, IEnumerable<String>)

Requires the JavaScript resource with specified path.

Declaration
public static ClientResourceSettings RequireScript(string scriptPath, string name, IEnumerable<string> dependencies)
Parameters
Type Name Description
System.String scriptPath

The script resource virtual path path or URL.

System.String name

The client resource name.

System.Collections.Generic.IEnumerable<System.String> dependencies

The names of other client resources that this script depends on.

Returns
Type Description
ClientResourceSettings

RequireScriptInline(String)

Requires the inline JavaScript.

Declaration
public static ClientResourceSettings RequireScriptInline(string scriptContent)
Parameters
Type Name Description
System.String scriptContent

Inline script content.

Returns
Type Description
ClientResourceSettings

RequireScriptInline(String, String, IEnumerable<String>)

Requires the inline JavaScript.

Declaration
public static ClientResourceSettings RequireScriptInline(string scriptContent, string name, IEnumerable<string> dependencies)
Parameters
Type Name Description
System.String scriptContent

Inline script content.

System.String name

The client resource name.

System.Collections.Generic.IEnumerable<System.String> dependencies

The names of other client resources that this script depends on.

Returns
Type Description
ClientResourceSettings

RequireStyle(String)

Requires the CSS resource with specified path.

Declaration
public static ClientResourceSettings RequireStyle(string cssPath)
Parameters
Type Name Description
System.String cssPath

The CSS resource virtual path path or URL.

Returns
Type Description
ClientResourceSettings

RequireStyle(String, String, IEnumerable<String>)

Requires the CSS resource with specified path.

Declaration
public static ClientResourceSettings RequireStyle(string cssPath, string name, IEnumerable<string> dependencies)
Parameters
Type Name Description
System.String cssPath

The CSS resource virtual path path or URL.

System.String name

The client resource name.

System.Collections.Generic.IEnumerable<System.String> dependencies

The names of other client resources that this CSS resource depends on.

Returns
Type Description
ClientResourceSettings

RequireStyleInline(String)

Requires the inline CSS block.

Declaration
public static ClientResourceSettings RequireStyleInline(string cssContent)
Parameters
Type Name Description
System.String cssContent

CSS content.

Returns
Type Description
ClientResourceSettings

RequireStyleInline(String, String, IEnumerable<String>)

Requires the inline CSS block.

Declaration
public static ClientResourceSettings RequireStyleInline(string cssContent, string name, IEnumerable<string> dependencies)
Parameters
Type Name Description
System.String cssContent

CSS content.

System.String name

The client resource name.

System.Collections.Generic.IEnumerable<System.String> dependencies

The names of other client resources that this CSS resource depends on.

Returns
Type Description
ClientResourceSettings