JSP code inside CSS Files

Within the web application I'm working, we've provided a way to have CSS files contain JSP code ( custom tags, EL expressions, etc).  What is the best way to have IDEA accommodate our setup, to provide, among other niceties, syntax highlighting?

I've added a file extension "*.dcss", which will be the extension of the CSS files that allow JSP code.  I was thinking this might help me get there, but I'm uncertain of what next steps I might take.  If I register "*dcss" to the list of JSP extensions, I'll get syntax highlighting for the JSP code, but lose it for CSS declarations.  If I register "*dcss" as a CSS extension, then its the other way around.

Any guidance would be appreciated.

~kc

3 comments

I am not sure if this works (it's been some time since my last JSP project, but I am using the method below to select the "target language" for freemarker files):

Assing *.dcss to JSP
Open project settings -> Template Data Languages
Check if you can select the CSS "Template data language" for one of the *.dcss files.
If you have all those files in a separate folder, you can select the CSS language for that complete folder.

If selecting a template data language for JSP files isn't possible, then I guess your best bet is to request it in JetBrains issue tracker.

0

That's an acceptable solution (and I'll mark the question as answered).  I no longer have the copious red-marks IDEA had been displaying, and IDEA is now applying JSP syntax coloring to it.  I don't have CSS autocompletion (since it is treated as a JSP), but that's fine for me.

Huge improvement.  Thanks for pointing out that Template Data Langauge, I would have never explored those settings.

~kc

0

On 3/3/2010 12:58 AM, Keith Collison wrote:

That's an acceptable solution (and I'll mark the question as answered).  I no longer have the copious red-marks IDEA had been displaying, and IDEA is now applying JSP syntax coloring to it.  I don't have CSS autocompletion (since it is treated as a JSP), but that's fine for me.

>

Huge improvement.  Thanks for pointing out that Template Data Langauge, I would have never explored those settings.

Not sure if this will help, but see if adding the following will give
you css highlighting:

<%@ page contentType="text/css;" language="java" %>

0

Please sign in to leave a comment.