Hi Prem,

> #if (#templateExists("$context/assets/organizations/$id/css/styles.css"))
>   #parse("$context/assets/organizations/$id/css/styles.css")
> #end
> 
> The error message I am receiving is this:
> 
> "Was expecting one of: "[" ,   "{" ,   "(" ,   <WHITESPACE> ,  
> <STRING_LITERAL> ,   "true" ,   "false" ,   <INTEGER_LITERAL> ,  
> <FLOATING_POINT_LITERAL> ,   <IDENTIFIER> ,   "{" ,   <LOGICAL_NOT>"

What is in styles.css? Since you are parsing it as a Velocity template,
you need to escape anything that's not meant to be Velocity code, for
example:

#header { color: #ffffff; }

should be

\#header { color: \#ffffff; }

If nothing at all in styles.css is Velocity code, then you should use
#include instead and you won't have to escape anything.

#if
(#templateExists("$context/assets/organizations/$id/css/styles.css"))
  #include("$context/assets/organizations/$id/css/styles.css")
#end

You can also assign the path to a variable to avoid repeating it, if
you wish.

#set ($css = "$context/assets/organizations/$id/css/styles.css")
#if (#templateExists($css))
  #include($css)
#end

Hope that helps.

Cheers,
Freddy

Reply via email to