mdn / css-examples

Code examples that accompany the MDN CSS documentation
https://developer.mozilla.org/docs/Web/CSS
Creative Commons Zero v1.0 Universal
618 stars 854 forks source link

Format all code #153

Closed OnkarRuikar closed 1 year ago

OnkarRuikar commented 1 year ago

The code hasn't been formatted ever and redundant white spaces are rampant. Also in learning area examples the code formatting is not the same as rest of the content.

The PR:

chrisdavidmills commented 1 year ago

Ah, damnit, I can't merge this.

caugner commented 1 year ago

@OnkarRuikar Can you share how you ran prettier here with mdn/content settings and how you formatted those playable text blocks?

OnkarRuikar commented 1 year ago

@OnkarRuikar Can you share how you ran prettier here with mdn/content settings and how you formatted those playable text blocks?

As this was one time formatting I used non standard ways. :p

For formatting I kept mdn/content as pwd and ran prettier from there and pointed to css-examples files using relative path. It was something like following:

cd mdn/content
mdn/content$ prettier --write "../css-examples/**/*"

Prettier doesn't format content inside <textarea> tag. For that I used regex search replace in IDE. Regexes were anchored on <textarea class="playable playable-. Used separate regexes for CSS and HTML blocks. For corner cases manually added spaces as it's easy and quicker to directly edit in diff view of IDE.


For long term solution it is better to setup prettier in this repo.\ For playable blocks there are two options: