# gulp-html-transform

> [![NPM version][npm]][npm-url] [![Node version][node]][node-url] [![Dependency status][deps]][deps-url]

Latest version **2.3.2** (published 2018-11-20) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.2 |
| Published | 2018-11-20 |
| First published | 2017-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=6.4.0 |
| Dependencies | 4 |
| Unpacked size | 5.8 MB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Gustav Bylund |
| Maintainers | maistho |

## Links

- npm: https://www.npmjs.com/package/gulp-html-transform
- Repository: https://github.com/maistho/gulp-html-transform
- npm.io page: https://npm.io/package/gulp-html-transform

## Dependencies (4)

- [lqip](https://npm.io/package/lqip.md) ^2.1.0
- [cheerio](https://npm.io/package/cheerio.md) ^1.0.0-rc.2
- [through2](https://npm.io/package/through2.md) ^3.0.0
- [image-size](https://npm.io/package/image-size.md) ^0.6.3

## Recent versions

- 2.3.2 (latest) — 2018-11-20
- 2.3.1 — 2018-11-20
- 2.2.4 — 2018-06-01
- 2.2.2 — 2018-03-31
- 2.2.1 — 2018-03-31
- 2.2.0 — 2018-03-31
- 2.1.0 — 2018-03-28
- 2.0.1 — 2018-03-08
- 2.0.0 — 2018-03-08
- 1.0.2 — 2017-12-06
- 1.0.1 — 2017-12-06
- 1.0.0 — 2017-12-06

## README

# gulp-html-transform

[![NPM version][npm]][npm-url]
[![Node version][node]][node-url]
[![Dependency status][deps]][deps-url]

[npm]: https://img.shields.io/npm/v/gulp-html-transform.svg
[npm-url]: https://www.npmjs.com/package/gulp-html-transform
[node]: https://img.shields.io/node/v/gulp-html-transform.svg
[node-url]: https://nodejs.org
[deps]: https://img.shields.io/david/Maistho/gulp-html-transform.svg
[deps-url]: https://david-dm.org/Maistho/gulp-html-transform

Transforms some html using transformer functions

## Installing

```bash
$ yarn add gulp-html-transform
```

## Plugins

- `insertFA`: transforms `<fa-icon>` into Font Awesome icons.
- `insertGA`: Inserts google analytics into `<head>`.
- `lqip`: Replaces images with [low quality image placeholders](https://github.com/zouhir/lqip). WARNING: Adds html, so may mess with your css selectors or other things.
- `minifyInlineJson`: Minifies inline JSON.
- `htmlSrcset`: Expands `srcset` in your `<img>`.

## Usage

#### gulpfile.js

```javascript
const { transform, htmlSrcset, lqip } = require('gulp-html-transform')

gulp.task('html', () => {
  gulp
    .src('src/**/*.html')
    .pipe(
      transform(
        htmlSrcset({
          width: [1, 720],
          format: ['webp', 'jpg'],
        }),
        lqip({
          base: __dirname,
        }),
      ),
    )
    .pipe(gulp.dest('dist'))
})
```

## API

transform accepts any number of transformer functions.

A transformer function takes a Cheerio Object as input (it's pretty much like jquery), and returns a Promise when done.

```javascript
// Example transformer function
const transformer = async $ => {
  $('img').attr('src', 'https://i.imgur.com/HObogkM.gif')
}
```

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