nghtml2pug
Converts angular **HTML** to **Pug** templating language (_formerly Jade_).
Last updated a year ago by pikulev .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install nghtml2pug 
SYNC missed versions from official npm registry.

nghtml2pug

Converts angular HTML to Pug templating language (formerly Jade).

Build Status

Initially forked from html2pug

nghtml2pug

Turns this :unamused:

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

Into this :tada:

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:

npm i nghtml2pug

In case your project doesn't have @angular/compiler

npm i @angular/compiler

Usage

CLI using NPX

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

# choose a file
npx nghtml2pug < example.html

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

Write output to a file:

npx nghtml2pug < example.html > example.pug

npx nghtml2pug -- --help for more information.

Programmatically

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

Current Tags

  • 0.1.12                                ...           latest (a year ago)

13 Versions

  • 0.1.12                                ...           a year ago
  • 0.1.11                                ...           a year ago
  • 0.1.10                                ...           a year ago
  • 0.1.9                                ...           a year ago
  • 0.1.8                                ...           a year ago
  • 0.1.7                                ...           a year ago
  • 0.1.6                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 13
Dependencies (4)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |