Socket
Socket
Sign inDemoInstall

html2pug

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html2pug

Converts HTML to Pug


Version published
Weekly downloads
1.3K
decreased by-12.71%
Maintainers
1
Weekly downloads
 
Created
Source

html2pug

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 install -g html2pug

Usage

CLI

Accept input from a file or stdin and write to stdout:

# choose a file
html2pug < example.html

# use pipe
echo '<h1>foo</h1>' | html2pug -f

Write output to a file:

html2pug < example.html > example.pug

See html2pug --help for more information.

Programmatically

const html2pug = require('html2pug')

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

Options

NameTypeDefaultDescription
useTabsBooleanfalseUse tabs instead of spaces
useCommasBooleantrueUse commas to separate node attributes, or a space if false
isFragmentBooleanfalseWraps result in enclosing <html> and <body> tags if false

Keywords

FAQs

Package last updated on 10 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc