# posthtml-pug
**Repository Path**: mirrors_posthtml/posthtml-pug
## Basic Information
- **Project Name**: posthtml-pug
- **Description**: Pug Parser
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-25
- **Last Updated**: 2025-09-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[![npm][npm]][npm-url]
[![node][node]][node-url]
[![deps][deps]][deps-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
[![code style][style]][style-url]
[![chat][chat]][chat-badge]
Pug
Parser for PostHTML
Install
```bash
npm i -D posthtml-pug
```
Usage
```js
import { readFileSync } from ('fs')
import pug from 'posthtml-pug'
import posthtml from 'posthtml'
const file = readFileSync('./index.pug', 'utf8')
posthtml()
.process(file, { parser: pug({ locals: {} }) })
.then((result) => console.log(result.html))
```
Options
See the [Pug API](https://pugjs.org/api/reference.html) for a full description of the options that can be passed.
By default the following options are set:
|Name|Default|
|:--:|:-----:|
|**`pretty`**|`true`|
|**`locals`**|`{}`|
Example
**index.pug**
```pug
doctype html
html
head
meta(charset="utf8")
title Pug Parser
body
h1#title Pug for PostHTML
p= greeting
```
###
```js
import { readFileSync } from ('fs')
import pug from 'posthtml-pug'
import posthtml from 'posthtml'
const file = readFileSync('./index.pug', 'utf8')
const locals = { greeting: 'Hello!' }
posthtml()
.process(file, { parser: pug({ locals: locals }) })
.then((result) => console.log(result.html))
```
**index.html**
```html
Pug Parser
Pug for PostHTML
Hello!
```
Maintainer
Contributors
[npm]: https://img.shields.io/npm/v/posthtml-pug.svg
[npm-url]: https://npmjs.com/package/posthtml-pug
[node]: https://img.shields.io/node/v/posthtml-load-options.svg
[node-url]: https://nodejs.org/
[deps]: https://david-dm.org/posthtml/posthtml-pug.svg
[deps-url]: https://david-dm.org/posthtml/posthtml-pug
[tests]: http://img.shields.io/travis/posthtml/posthtml-pug.svg
[tests-url]: https://travis-ci.org/posthtml/posthtml-pug
[cover]: https://coveralls.io/repos/github/posthtml/posthtml-pug/badge.svg?branch=master
[cover-url]: https://coveralls.io/github/posthtml/posthtml-pug?branch=master
[style]: https://img.shields.io/badge/code%20style-standard-yellow.svg
[style-url]: http://standardjs.com/
[chat]: https://badges.gitter.im/posthtml/posthtml.svg
[chat-badge]: https://gitter.im/posthtml/posthtml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"