Change css format style sheets in Eclipse

This way Eclipse can automatically format my css files in Source-> Format or by pressing Cntl-Shift-F.

When I group a selector for one rule, eclipse formats it like this:

.planner th,.planner td { border: 1px solid black; } 

I would really like Eclipse to add a space between selectors for readability, for example:

 .planner th, .planner td { border: 1px solid black; } 

Is there a way to configure Eclipse for this? I am running Eclipse Indigo.

+7
source share
3 answers

The Aptana Studio plugin for eclipse has a formatter pre-configured to suit your needs.

I recommend using it no matter how it facilitates the development process for web developers (all sorts of great features such as built-in Git integration, code support for shared JavaScript libraries, built-in FTP client, built-in AJAX server [Jaxer], good themes included , and so on, etc.).

Literature:

+1
source

The easiest way to solve your problem is to run the find / replace command.

  • Open the file / Replace ( Ctrl + F ) in the CSS file.
  • Find:, ,\.
  • Replace:, , \.
  • Check the regular expressions box.
  • Click Replace All .

Alternatively, if your request cannot be customized using the CSS editor (which looks like this), then you will need to make a plugin for it.

The CSS editor is here:

 Preferences > Web > CSS Files > Editor 

If you plan to create a plugin, check out the org.eclipse.jdt.core.formatter package for reference.

Further information here:

+1
source

You can add a CSS class macro rule or even a macro; it works fine in a text file, but not so much in a Java editor.

But your correct answer is to add / change the rules in ICSSStyleSheet, there is an explanation here: http://lab.benstucki.net/flashsac/doc/org/w3c/css/dom/ICSSStyleSheet.html#insertRule () <- enable these parentheses.

0
source

All Articles