Prevent eclipse from destroying CSS formatting
Asked Answered
N

1

11

Eclipse seems to be completely oblivious of EL expressions inside CSS. When I format my stylesheets, this happens:

.tooltip:hover span.info {
  ...
  border-color: #{theme.get('borderTooltip')};
  border-style: solid;
  ...
}

turns into

.tooltip:hover span.info {
  ...
  border-color: #{theme.get('borderTooltip' )
}

;
border-style
:

solid
;
...
}

Is there anything I can do to prevent this and still use the formatter?

Nevarez answered 8/6, 2012 at 9:20 Comment(5)
In other file types I have used /* @formatter:off */ and /* @formatter:on */ comments around sections of code that the formatter messes up. However, that doesn't seem to work with the CSS formatter for me.Taveras
wow, four years later, still broken :) salute to progressNevarez
I'm actually running into issues with @keyframes notation per this bug: bugs.eclipse.org/bugs/show_bug.cgi?id=442852Taveras
Eclipse users, please ensure to up-vote the bug as linked by @StephenOstermillerEngleman
@Nevarez five years, eight months, still broken (Oxygen.2 4.7.2). But you know what they say, "when life gives you bugged free software..."Licketysplit
D
-3

Go to the Eclipse preferences Window -> Preferences. And enter formatter into the search box on the upper left. I don't know which plugin performs the formatting in your case maybe you find the right one here and can change its configuration.

Declarer answered 8/6, 2012 at 9:40 Comment(3)
Thanks, I know how to use the eclipse formatter. The CSS formatter does not offer any helpful options for my issue.Nevarez
@kostja: Are you using eclipse webtools? Maybe you should give CSS Editor a try.Declarer
This answer isn't specific enough to be helpful.Taveras

© 2022 - 2024 — McMap. All rights reserved.