waterplea
waterplea

Reputation: 3631

Eclipse: Ignore "Undefined CSS class" warning

I use Spring and have found this answer to similar question, however it not at all satisfactory since it requires changing project structure: Get Eclipse to recognise CSS included via context in Spring MVC project

So the question is, can I somehow set Eclipse to ignore "Undefined CSS class" warning.

It's not just about Spring, I might have some CSS classes I use in JavaScript that are not present in CSS spreadsheet or any other reason. The warning is shown on every element on html that uses css class that it cannot find, say:

<div class="js-something">Something</div>

This class is not going to be defined in .css file since it is only used in JavaScript. Same thing with Spring where .css is connected with:

<link href="<c:url value='/css/style.css'/>" rel="stylesheet" type="text/css" />

Or in AngularJS project where html files are added with ng-include. This warning is really barely helpful, it probably should be even disabled by default. I've looked all through Eclipse settings but couldn't find any way to ignore this kind of warnings. Can anybody help me get rid of those?

Upvotes: 10

Views: 13331

Answers (1)

waterplea
waterplea

Reputation: 3631

Allright, I've found it. Funnily enough, it is under "Validation" if you edit project preferences, but not in overall preferences, that's why I couldn't find it when searching preferences by "Validation".

In project preferences: Web Resources -> Validation -> CSS

In overall preferences: Web -> HTML Files -> Web Resources -> CSS

Finally my projects are no longer riddled with yellow markers.

Upvotes: 23

Related Questions