Jun 26, 2012 2:26 PM
135 Posts

Can I compute <resource> (CSS) in theme?

  • Category: Styles and Themes
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: theme,resource,css
  • Replies: 2
Hi,
 
I'd like to use a customer specific CSS file (rendered= does not fit very well to this need). Neither of these work: 
 
<resource>
   <content-type>text/css</content-type>
   <href>#{javascript:"test.css"}</href>
</resource>
 
<resource>
   <content-type>text/css</content-type>
   <href><value>#{javascript:"test.css"}</value></href>
</resource>
 
I know I can compute the css on the XPage/Custom Control but can I do it in theme level? 
 
thanks, 
 
- Panu 
 
 
Jun 26, 2012 2:55 PM
10 Posts
Re: Can I compute <resource> (CSS) in theme?
You can use rendered to compute whether a resource is used or not. Here are some examples:

<resource rendered="#{javascript:context.getUserAgent().getUserAgent().match("iPhone")}">
      <content-type>text/css</content-type>
      <href>iPhone.css</href>
 </resource>

<resource rendered="#{javascript:context.getUserAgent().isIE(0,6) == true}"> 
      <content-type>text/css</content-type>
      <href>ie6.css</href>
 </resource>
 
So, using the rendered property you can control when to load a specific resource. Does that answer your question? 
Jun 26, 2012 3:17 PM
135 Posts
Re: Can I compute <resource> (CSS) in theme?
Hi,
 
I would not like to code all CSS file names to the theme. There is one CSS file for each customer and new ones are coming in all the time as new customers are added. That's why I'd prefer not to use the rendered property.
 
- Panu