Clean-Up your code!

Clean code means readable code by anyone, no duplications, faster performance and the best thing of all is you can edit that code easier.

JAVASCRIPT : a very good website that can tide up your code especially if is a big mess and you cannot read or edit the code use: About.com – Javascript Formatter. Just copy and paste your javascript code inside the textarea and press clean.

CSS : cascading style sheets. No more having the same class more than once or classes that do the same thing. By using the
W3C CSS Validation Tool 1st it will validate your code and 2nd generate for you a clean version
of your css code nice and tide.

PrettyPrinter.de

If you would like a more sophisticate source code formatter I believe PrettyPrinter is the best I used so far. Visit Site. The reason is that this site enables the user to customize the code format according to its needs. The following parameters can be applied:

  • Add new lines after “{” and before “}”
  • Add new lines before “{“
  • Remove empty lines.
  • Add comment lines before function.
  • Add new lines after “;”
  • Add new lines after “}” (For .css) (Thanks David)
  • Remove new lines (useful only if you add them again with the other functions above)
  • Add new lines after “;” but not in for loops (Don’t check “Remove new lines” but do check “Remove empty lines”)(Thanks Chris) (Experimental, uses a heuristic that might fail )
  • Add new lines after “;” but not in for loops and skip quotes (Don’t check “Remove new lines” but do check “Remove empty lines”) (Thanks Chris) (Experimental, uses a heuristic that might fail )
  • Reduce whitespace
  • Put the code again in the input box above after submit.
  • Skip HTML, give me plain code! (Use Save-As function of your browser)

Leave a Reply