# nghtml2pug

> Converts angular **HTML** to **Pug** templating language (_formerly Jade_).

Latest version **0.1.12** (published 2019-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install nghtml2pug
pnpm add nghtml2pug
yarn add nghtml2pug
bun add nghtml2pug
```

Provides the command `nghtml2pug`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.12 |
| Published | 2019-05-30 |
| First published | 2019-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 54.2 KB |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | pikulev |
| Maintainers | pikulev |
| Keywords | angular, ng, html, pug, jade, convert, templates |

## Links

- npm: https://www.npmjs.com/package/nghtml2pug
- Repository: https://github.com/pikulev/nghtml2pug
- Homepage: https://github.com/pikulev/nghtml2pug#readme
- Issues: https://github.com/pikulev/nghtml2pug/issues
- npm.io page: https://npm.io/package/nghtml2pug

## Dependencies (4)

- [yargs](https://npm.io/package/yargs.md) ^13.2.4
- [get-stdin](https://npm.io/package/get-stdin.md) ^7.0.0
- [html-minifier](https://npm.io/package/html-minifier.md) ^4.0.0
- [@angular/compiler](https://npm.io/package/@angular/compiler.md) ^7.2.15

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.1.12 (latest) — 2019-05-30
- 0.1.11 — 2019-05-30
- 0.1.10 — 2019-05-30
- 0.1.9 — 2019-05-30
- 0.1.8 — 2019-05-30
- 0.1.7 — 2019-05-30
- 0.1.6 — 2019-05-30
- 0.1.5 — 2019-05-30
- 0.1.4 — 2019-05-30
- 0.1.3 — 2019-05-30
- 0.1.2 — 2019-05-30
- 0.1.1 — 2019-05-30
- 0.1.0 — 2019-05-30

## README

# nghtml2pug
Converts angular **HTML** to **Pug** templating language (_formerly Jade_).

[![Build Status](https://travis-ci.org/pikulev/nghtml2pug.svg?branch=master)](https://travis-ci.org/pikulev/nghtml2pug)

_Initially forked from [html2pug](https://github.com/izolate/html2pug)_

<p align="center">
  <img src="https://raw.githubusercontent.com/pikulev/nghtml2pug/master/repo_files/cover.png" alt="nghtml2pug">
</p>

Turns this :unamused:
```html
<ng-container *ngFor="lel item of items; let i = index">
  <span class="icon"></span> {{ i + 1}}.{{ item }}
</ng-container>
```

Into this :tada:
```pug
ng-container(*ngFor='lel item of items; let i = index')
  span.icon
  |  {{ i + 1}}.{{ item }}
```

### IMPORTANT: PEER DEPENDENCY
It uses Angular HTML parser from `"@angular/compiler": "^7.2.15"`.

So *there is a peer dependency*, make sure you have it installed.

## Install

Get it on [npm](https://www.npmjs.com/package/nghtml2pug):

```bash
npm i nghtml2pug
```

In case your project doesn't have `@angular/compiler`
```bash
npm i @angular/compiler
```

## Usage

### CLI using NPX
Accept input from a file or stdin and write to stdout:

```bash
# choose a file
npx nghtml2pug < example.html

# use pipe
echo '<h1>foo</h1>' | npx nghtml2pug
```

Write output to a file:
```bash
npx nghtml2pug < example.html > example.pug
```

`npx nghtml2pug -- --help` for more information.

### Programmatically

```js
const ngHTML2Pug = require('nghtml2pug')

const html = '<tg-template #title><h1>Hello World!</h1></ng-template>'
const pug = ngHTML2Pug(html, { useTabs: true })
```

### Options

Name | Type | Default | Description
--- | --- | --- | ---
useTabs | Boolean | `false` | Use tabs instead of spaces
useDoubleQuotes | Boolean | `false` | Use double quotes instead of single quotes

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