# gulp-diffable-html

> gulp plugin formatting html via diffable-html.

Latest version **4.0.0** (published 2026-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-diffable-html
pnpm add gulp-diffable-html
yarn add gulp-diffable-html
bun add gulp-diffable-html
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-05-28 |
| First published | 2019-09-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^22.19.0 \|\| >=24.11.0 |
| Dependencies | 5 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5 |
| Author | ntnyq |
| Maintainers | ntnyq |
| Keywords | beauty, diffable-html, format, gulp, gulp-plugin, html, pretty |

## Links

- npm: https://www.npmjs.com/package/gulp-diffable-html
- Repository: https://github.com/ntnyq/gulp-plugins
- Issues: https://github.com/ntnyq/gulp-plugins/issues
- npm.io page: https://npm.io/package/gulp-diffable-html

## Dependencies (5)

- [through2](https://npm.io/package/through2.md) ^5.0.1
- [plugin-error](https://npm.io/package/plugin-error.md) ^2.0.1
- [@ntnyq/logger](https://npm.io/package/@ntnyq/logger.md) ^0.2.0
- [diffable-html](https://npm.io/package/diffable-html.md) ^6.0.1
- [@types/through2](https://npm.io/package/@types/through2.md) ^2.0.41

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2026-05-28
- 3.2.0 — 2025-03-08
- 3.1.0 — 2025-03-08
- 3.0.0 — 2024-07-31
- 2.2.0 — 2023-09-30
- 2.1.0 — 2023-06-29
- 2.0.0 — 2023-05-14
- 1.4.2 — 2023-03-11
- 1.4.1 — 2023-02-18
- 1.4.0 — 2023-01-08
- 1.3.0 — 2022-12-06
- 1.2.1 — 2022-12-06
- 1.2.0 — 2022-12-06
- 1.1.7 — 2022-11-06
- 1.1.5 — 2020-06-27
- … 6 more at https://npm.io/package/gulp-diffable-html/versions

## README

# gulp-diffable-html

:beer: gulp plugin formatting html via diffable-html

[![NPM VERSION](https://img.shields.io/npm/v/gulp-diffable-html?logo=npm)](https://www.npmjs.com/package/gulp-diffable-html)
[![NPM DOWNLOADS](https://img.shields.io/npm/dm/gulp-diffable-html?logo=npm)](https://www.npmjs.com/package/gulp-diffable-html)

## Install

```shell
npm install gulp-diffable-html -D
```

```shell
yarn add gulp-diffable-html -D
```

```shell
pnpm add gulp-diffable-html -D
```

## Setup

```js
const gulp = require('gulp')
const diffableHTML = require('gulp-diffable-html')
// or
// const { diffableHTML } = require(`gulp-diffable-html`)

function views() {
  return gulp
    .src('views/**/*.html')
    .pipe(diffableHTML())
    .pipe(gulp.dest('dist'))
}

exports.dev = gulp.series(views)
```

```ts
import gulp from 'gulp'
import diffableHTML from 'gulp-diffable-html'
// or
// import { diffableHTML } from 'gulp-diffable-html'

function views() {
  return gulp
    .src('views/**/*.html')
    .pipe(diffableHTML())
    .pipe(gulp.dest('dist'))
}

export const dev = gulp.series(views)
```

## Features

- zero-config
- indenting every level with 2 spaces
- align attributes
- put every opening and closing tag on its own line
- trimming text nodes

## Example

Input:

<!-- prettier-ignore-start -->
```html
<!DOCTYPE html><!--[if IE 9]>.... some HTML here ....<![endif]--><html lang="en"><head><meta charset="UTF-8"><title>gulp-diffable-html</title></head><body><header><h1><span>I am h1 in header</span></h1></header><main><p><!----><span></span><b>b</b><strong>strong</strong><em>&copy;</em><!-- This comment should be removed --></p></main><footer><p><a href="https://github.com/ntnyq/gulp-diffable-html" target="_blank" rel="noopener" >gulp-diffable-html</a></p></footer></body></html>
```
<!-- prettier-ignore-end -->

Output:

<!-- prettier-ignore-start -->
```html
<!DOCTYPE html>
<!--[if IE 9]>.... some HTML here ....<![endif]-->
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>
      gulp-diffable-html
    </title>
  </head>
  <body>
    <header>
      <h1>
        <span>
          I am h1 in header
        </span>
      </h1>
    </header>
    <main>
      <p>
        <span> </span>
        <b>
          b
        </b>
        <strong>
          strong
        </strong>
        <em>
          &copy;
        </em>
      </p>
    </main>
    <footer>
      <p>
        <a
          href="https://github.com/ntnyq/gulp-diffable-html"
          target="_blank"
          rel="noopener"
        >
          gulp-diffable-html
        </a>
      </p>
    </footer>
  </body>
</html>
```
<!-- prettier-ignore-end -->

## Options

**gulp-diffable-html** is based on [diffable-html](https://github.com/rayrutjes/diffable-html).

### sortAttributes

- **type** `function`
- **default** `(names) => names`

Customize the order of attributes on HTML tag.

### verbose

- **type** `boolean`
- **default** `false`

Display name of file from stream that is being formatting

## License

[MIT](./LICENSE) License © 2024-PRESENT [ntnyq](https://github.com/ntnyq)

---
_Source: https://npm.io/package/gulp-diffable-html · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
