-1

I have an EPiServer plugin that links to style resources like this

<link rel="stylesheet" type="text/css" href="/episerver/Shell/8.5.1.0/ClientResources/epi/themes/legacy/ShellCore.css">
<link rel="stylesheet" type="text/css" href="/episerver/Shell/8.5.1.0/ClientResources/epi/themes/legacy/ShellCoreLightTheme.css">

Now to get the correct version of the resources I need to get the correct EPiServer.Shell.UI assembly version. (The 8.5.1.0 part of the url). At the moment I'm doing that with reflectiion of the EPiServer.Shell.UI assembly and retrieving the version from there.

I've googled to find a cleaner way of doing this but the only blog post about retrieving EPiServer shell styles was for WebForms in EPiServer version 6. I've also read this article about Client resources but I unsure if it even has anything to do with plugins.

Some help and tips from someone who has knowledge of these plugins are most welcome!

(So to make the question clear; what is the correct way to render links to EPiServer Shell stylesheets from a plugin?)

Andreas
  • 2,336
  • 2
  • 28
  • 45

1 Answers1

3

You can put this into the head tag of your plugin page:

<%=Page.ClientResources("ShellCore")%>
<%=Page.ClientResources("ShellCoreLightTheme")%>
SergVro
  • 721
  • 1
  • 6
  • 9
  • Hi and thanks for the answer. The property "Page" contains 0 items, do I need to populate it with module.config or code or should it be populated out of the box? – Andreas Sep 21 '15 at 12:38
  • ClientResources is an extension method for System.Web.UI.Page (http://world.episerver.com/documentation/Class-library/?documentId=cms/8/6E3747BC). Resources "ShellCore" and "ShellCoreLIghtTheme" are predefined, so it should just work. – SergVro Sep 21 '15 at 15:37
  • Finally found the magic solution after a lot of digging in the assembly methods. @Paths.ToShellClientResource("ClientResources/epi/themes/legacy/ShellCore.css"). So you got me going in the correct direction :) – Andreas Sep 22 '15 at 05:54