A simple gulp plugin to make HTML pretty
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
index.js
package.json
yarn.lock

README.md

Gulp pretty HTML

A simple Gulp plugin to make HTML pretty.

Why?

Sometimes you need to deliver pretty HTML. Since Jade became Pug the pretty option has been marked as deprecated. This small plugin intends to replace it.

I made it for that usage but maybe there is others, dunno :)

Prerequisites

  • Gulp >= 3

Installation

npm install @awea/gulp-pretty-html

or

yarn add @awea/gulp-pretty-html

Options

Gulp pretty HTML uses pretty to prettify the HTML. The only option is {ocd: true / false}. As explained in pretty README this option will:

condenses multiple newlines to a single newline trims leading and trailing whitespace ensures that a trailing newline is inserted normalizes whitespace before code comments

Usage example

For a given Gulp pug task:

gulp.task('pug', function (done) {
  gulp.src('templates/**/*.pug')
    .pipe(pug())
    .pipe(gulp.dest('./dist'))
    .on('end', done)
});

Simply add pretty() after pug():

var pretty = require('@awea/gulp-pretty-html')

gulp.task('pug', function (done) {
  gulp.src('templates/**/*.pug')
    .pipe(pug())
    .pipe(pretty())
    .pipe(gulp.dest('./dist'))
    .on('end', done)
});