criteria to activate my own css definitions

Topics: Administration, General, Writing modules
May 1, 2012 at 7:50 PM

In a 'Projector' page I use 'queries>layouts>unordered list>HTML properties'. The filled properties get picked correctly as long as I add the  '.ItemClass{ color: red; }' in the Themes\Styles\Site.css folder - i.e. all is ok color turns red!

when adding .ItemClass in the 'Module\MyModule\Styles\My.css' folder - nothing happens!

I also added <Content Include="Styles\My.css" /> to my.csproj file!

I start to wonder what for Orchard is using the automatic generated (at Module generation) \Styles folder!

? what am I missing to make Orchard aware of my css change?

PS: I don't like to change the main Site.css for such things!
thanks for your time

May 1, 2012 at 8:37 PM

What you're missing is that you need code to include the stylesheet. That <content> tag in the project file is just bringing it into the project, not into your pages. Take a look at layout.cshtml for an example of how stylesheets are brought in.

May 2, 2012 at 6:50 AM
Edited May 2, 2012 at 6:51 AM

thank you, .... this is strange !

I have applied / tested using  'Style.Include("My.css");' in my .cshtml

so far I always tested it using VS2010 (i.e. Orchard SRC) - with original Theme 'TheThemeMachine'.

 Now, when doing the same thing in WebMatrix (which I want to use for deploy) - it works!
To confirm: is use a separate .css like 'MyModule\Styles\My.css' and changing this .css file also changes the layout - all ok.
PS: in WebMatrix; the 'only' difference (as far as I can see); I use 'TheThemeMachine' As 'MyTheme' (in both I have the 'Site.css' unchanged!)

? So back to OrchardSRC:  what do I possibly miss here ?

thanks for your time and hints


May 2, 2012 at 7:12 AM

You didn't say what's not working or how it's not working.

May 2, 2012 at 5:08 PM
Edited May 2, 2012 at 5:10 PM

sorry for being not clear!

In my OrchardSRC (VS2010, which I use to test)
I always used  'Style.Include("My.css");' in My.cshtml. And included My.css also in My.csproj
But it never picks up the classes defined in My.css

Then I applied the very same thing to my WebMatrix project:
... and it works! PS: I can definitely see it when changing class parameters!

As said in previous msg: the only difference I see is: using, in WebMatrix', another Theme ('MyTheme') which is essentially  a duplicate of 'TheThemeMachine'.
This to make sure I have not to change the original Site.css if needed.

PS: I tirple checked the setup in both but cannot get the OrchardSRC get working

surely I must miss something  ...
Thank for your help






May 2, 2012 at 5:17 PM

What do you see in the network tab of your browser's dev tools?

May 2, 2012 at 6:32 PM

Hi Bertrand,

my apologies, another blob! But thanks for asking the right question.

In the network dev tool>response body  I found  that my defined ItemClass (queries>>HTML properties ) was NOT inserted!

Finally I figured that I used the wrong query in my 'Projection' page - that easy!
sorry again but thans anyway