Skip to content

Awea/gulp-pretty-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
});

About

A simple gulp plugin to make HTML pretty

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published