Search code examples
.net-4.5orchardcmsazure-deployment

Orchard - Stylesheet not found with Style.Require in Orchard 1.8


I just upgraded my site to Orchard version 1.8. Everything is fine until I use Orchard.Azure to publish to my Cloud Service.

Then the site responds with:

A 'stylesheet' named 'Menus' could not be found.

Menus is the name of the resource bundle in my theme, which is also where the css is located. And is included in the Layout.cshtml by:

Style.Require("Menus").AtHead();

I can remove this error by using Style.Include. But then it won't find the css when running locally.

I didn't have this problem with Orchard 1.7.

The theme project is updated to .NET4.5 and all nessecary steps to convert it to fit Orchard 1.8 are done.

Does anyone have any ideas on how to solve this?


Solution

  • Resource bundles in themes don't make a whole lot of sense, unless I'm missing something: resource bundles are for resources that are likely to be re-used across modules, and as such should be defined by modules, not themes.

    If you Include using the plain file name of a style sheet under the Styles folder of your theme, it will be found, both locally and deployed.

    Style.Include("menus.css")
    

    will work provided the file menus.css is under /Themes/YourTheme/Styles.

    As a side note, AtHead is redundant for style sheets as those are never included to the bottom of the page, only in the head. You can remove it.