An open API service indexing awesome lists of open source software.

https://github.com/softonus-io/prettier-plugin-whitespace-remover

A Prettier plugin that removes excessive whitespace from class and className attributes in HTML, Vue.js, React, and Angular, helping to improve code readability and maintain consistency.
https://github.com/softonus-io/prettier-plugin-whitespace-remover

prettier prettier-eslint prettier-plugin prettier-plugin-tailwindcss prettierconfig prettierrc whitespace whitespace-removal

Last synced: 4 days ago
JSON representation

A Prettier plugin that removes excessive whitespace from class and className attributes in HTML, Vue.js, React, and Angular, helping to improve code readability and maintain consistency.

Awesome Lists containing this project

README

          

# πŸš€ Prettier Plugin: Whitespace Remover

A powerful Prettier plugin designed to remove unnecessary whitespaces from class attributes (`class` and `className`) across **Vue.js**, **Angular**, **React**, **Next**, **Nuxt** and **HTML** projects.

This plugin ensures that class names are clean and consistently formatted by trimming excess spaces and standardizing them, improving the overall code quality.

---

## πŸ—‚ Installation

Install the plugin for your project using one of the following package managers:

**Bun:**

```bash
bun add -D @softonus/prettier-plugin-whitespace-remover
```

**Yarn:**

```bash
yarn add -D @softonus/prettier-plugin-whitespace-remover
```

**npm:**

```bash
npm install --save-dev @softonus/prettier-plugin-whitespace-remover
```

---

## πŸ”¨ Usage

1. **Create a `.prettierrc` file** (if you don’t already have one) in your project’s root directory.

2. **Add the plugin to your Prettier configuration**:

```json
{
"plugins": ["@softonus/prettier-plugin-whitespace-remover"]
}
```

This will automatically apply the plugin to clean up whitespace in your **React**, **Vue.js**, **Angular**, **Next**, **Nuxt** and **HTML** projects.

---

## 🌐 Supported Frameworks

- **React** & **Next.js**: Cleans up `className` attributes.
- **Vue.js**: Cleans up `class` attributes within `.vue` files.
- **Angular**: Cleans up `class` attributes in HTML and Angular templates.
- **Plain HTML**: Cleans up `class` attributes in regular HTML files.

---

## ⚑ Features

- **Cleans up class names**: Removes unnecessary spaces and trims multiple spaces into a single space.
- **Works across all major frameworks**: Supports React, Vue, Angular, Next.js, and plain HTML.
- **Zero configuration**: Simply add the plugin and start formatting.

---

## πŸ“ Example

### Before Prettier:

```html


Hello World

```

### After Prettier:

```html


Hello World

```

---

## πŸ“¨ Contact

For inquiries or suggestions, reach out to me at [ebo@softonus.com](mailto:ebo@softonus.com).

---

## 🀝 Contributions

Contributions are welcome! If you have any improvements or fixes, feel free to open an issue or create a pull request.

---

## 🏷️ License

Distributed under the MIT License. See [LICENSE](LICENSE) for more information.