Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pugjs/pug-cli
Pug's CLI interface
https://github.com/pugjs/pug-cli
Last synced: 5 days ago
JSON representation
Pug's CLI interface
- Host: GitHub
- URL: https://github.com/pugjs/pug-cli
- Owner: pugjs
- License: mit
- Created: 2015-06-02T09:41:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-07-30T16:27:48.000Z (6 months ago)
- Last Synced: 2025-01-06T08:12:07.176Z (16 days ago)
- Language: JavaScript
- Homepage:
- Size: 67.4 KB
- Stars: 259
- Watchers: 13
- Forks: 63
- Open Issues: 46
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.md
Awesome Lists containing this project
README
# pug-cli
Pug's CLI interface
[![Build Status](https://img.shields.io/travis/pugjs/pug-cli/master.svg)](https://travis-ci.org/pugjs/pug-cli)
[![Dependency Status](https://img.shields.io/david/pugjs/pug-cli.svg)](https://david-dm.org/pugjs/pug-cli)
[![NPM version](https://img.shields.io/npm/v/pug-cli.svg)](https://www.npmjs.org/package/pug-cli)
[![Coverage Status](https://img.shields.io/codecov/c/github/pugjs/pug-cli.svg)](https://codecov.io/gh/pugjs/pug-cli)## Usage
```
$ pug [options] [dir|file ...]
```Render ``s and all files in ``s. If no files are specified,
input is taken from standard input and output to standard output.### Options
```
-h, --help output usage information
-V, --version output the version number
-O, --obj JSON/JavaScript options object or file
-o, --out output the rendered HTML or compiled JavaScript to
-p, --path filename used to resolve includes
-b, --basedir path used as root directory to resolve absolute includes
-P, --pretty compile pretty HTML output
-c, --client compile function for client-side runtime.js
-n, --name the name of the compiled template (requires --client)
-D, --no-debug compile without debugging (smaller functions)
-w, --watch watch files for changes and automatically re-render
-E, --extension specify the output file extension
-s, --silent do not output logs
--name-after-file name the template after the last section of the file
path (requires --client and overriden by --name)
--doctype specify the doctype on the command line (useful if it
is not specified by the template)
```### Examples
Render all files in the `templates` directory:
```
$ pug templates
```Create `{foo,bar}.html`:
```
$ pug {foo,bar}.pug
```Using `pug` over standard input and output streams:
```
$ pug < my.pug > my.html
$ echo "h1 Pug!" | pug
```Render all files in `foo` and `bar` directories to `/tmp`:
```
$ pug foo bar --out /tmp
```Specify options through a string:
```
$ pug -O '{"doctype": "html"}' foo.pug
# or, using JavaScript instead of JSON
$ pug -O "{doctype: 'html'}" foo.pug
```Specify options through a file:
```
$ echo "exports.doctype = 'html';" > options.js
$ pug -O options.js foo.pug
# or, JSON works too
$ echo '{"doctype": "html"}' > options.json
$ pug -O options.json foo.pug
```## Installation
npm install pug-cli -g
## License
MIT