html-pug-converter
Converts HTML to Pug
Last updated a year ago by toshioakaneya .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install html-pug-converter 
SYNC missed versions from official npm registry.

html-pug-converter

Converts HTML to Pug templating language (formerly Jade).
Requires Node.js version 7.6 or higher.

Turns this :unamused:

<!doctype html>
<html lang="en">
  <head>
    <title>Hello World!</title>
  </head>
  <body>
    <div id="content">
      <h1 class="title">Hello World!</h1>
    </div>
  </body>
</html>

Into this :tada:

doctype html
html(lang='en')
  head
    title Hello World!
   body
    #content
      h1.title Hello World!

Install

Get it on npm:

npm i -g html-pug-converter

Usage

CLI

Accept input from a file and write to stdout:

html-pug-converter < example.html

Or write to a file:

html-pug-converter < example.html > example.pug

See html-pug-converter --help for more information.

Programmatically

const htmlPugConverter = require('html-pug-converter')

const html = '<header><h1 class="title">Hello World!</h1></header>'
const pug = htmlPugConverter(html, { tabs: true })

Options

Name Type Default Description
tabs Boolean false Use tabs instead of spaces
fragment Boolean false Wrap in enclosing <html> and <body> tags

Current Tags

  • 3.0.0                                ...           latest (a year ago)

1 Versions

  • 3.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (4)
Dev Dependencies (10)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |