Skip to content

How to use resource from a package

Mariush Minkov edited this page Jul 15, 2015 · 6 revisions

Now you have the ability to group your resources in a separate packages and Sitefinity will automatically apply this packages over your templates based on their naming. A package can contains stylesheets, scripts, images, even whole layout templates.

A new folder structure is introduced in the web application to enable packaging of resources. ~/ResourcePackages/[Package Name]/

You can have several packages with different package names. A page template can use one package. If the page template title is "My Package.My Template" then it will use a package names "My Package".

When a page template uses a package all resource references that are referred with Url.WidgetContent helper will be overridden by the existing files in the package folder.

Example: You have a page template named My Package.My Template. A page based on this template has a widget on it that references a stylesheet like this: <link rel="stylesheet" href='@Url.WidgetContent("Mvc/Styles/Css/sitefinity-theme.css")'> (this is the way all default widget reference their resources). The site can have the following files: ~/Mvc/Styles/Css/sitefinity-theme.css ~/ResourcePackages/My Template/Mvc/Styles/Css/sitefinity-theme.css The WidgetContent helper will ensure that the second file will be retrieved and the first will be ignored.

Clone this wiki locally