ben-eb / perfectionist

Beautify CSS files.
MIT License
229 stars 14 forks source link

Add newline (or 2) before opening comment #4

Closed kfriend closed 8 years ago

kfriend commented 8 years ago

Take a look at the following minimized CSS sample, and perfectionist output. As you can see, the last comment is snug up against the closing bracket of the previous block.

Also, it's hard to spot at first, but the first comment is actually 2 comments, and could benefit from new lines added between them. Probably harder to implement, though. I'm not that familiar with PostCSS, not sure what functionality it has for comments.

Minimized CSS:

/*! normalize.css v3.0.2 | MIT License | git.io/normalize *//**
 * 1. Set default font family to sans-serif.
 * 2. Prevent iOS text size adjust after orientation change, without disabling
 *    user zoom.
 */html {font-family: sans-serif;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;}/**
 * Remove default margin.
 */body {margin: 0;}

Output:

 /*! normalize.css v3.0.2 | MIT License | git.io/normalize *//**
  * 1. Set default font family to sans-serif.
  * 2. Prevent iOS text size adjust after orientation change, without disabling
  *    user zoom.
  */

 html {
     font-family: sans-serif;
         -ms-text-size-adjust: 100%;
     -webkit-text-size-adjust: 100%;
 }/**
  * Remove default margin.
  */

 body {
     margin: 0;
 }

Thanks again!

ben-eb commented 8 years ago

Yeah, we can probably do something for comments. :+1:

kfriend commented 8 years ago

Fantastic, thanks Ben!

ben-eb commented 8 years ago

Released in 1.1.0.

kfriend commented 8 years ago

You da bomb!

ben-eb commented 8 years ago

Thanks :smile: