Socket
Socket
Sign inDemoInstall

nunjucks-cli

Package Overview
Dependencies
6
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nunjucks-cli

Nunjucks CLI wrapper and templates watcher


Version published
Weekly downloads
136
decreased by-46.03%
Maintainers
1
Install size
2.88 MB
Created
Weekly downloads
 

Readme

Source

Nunjucks-cli

Simple Nunjucks CLI Wrapper and templates watcher, to generate static HTML files.

Installation

npm i -D nunjucks-cli # local
npm i -g nunjucks-cli # global

Usage

nunjucks <file|glob> [context] [options]

For convenience, process.env object is added to the context as env.

Basic examples
nunjucks foo.tpl data.json

Compiles foo.tpl to foo.html with data from data.json (and variables from process.env as env).

nunjucks **/*.tpl

Compiles all .tpl files (including subdirectories), except the ones starting by _ (so you can use them as layouts).

Options

--path <directory>

-p <directory>

Path where the templates live. Default to the current working directory. See https://mozilla.github.io/nunjucks/api.html#configure

--out <directory>

-o <directory>

Output directory.

--watch

-w

Allows to keep track of file changes and render accordingly (except files starting by _).

--extension <ext>

-e <ext>

Extension for rendered files. Defaults to html.

--options <file>

-O <file>

Takes a json file as Nunjucks options. Defaults are :

trimBlocks: true,
lstripBlocks: true,
noCache: true

See https://mozilla.github.io/nunjucks/api.html#configure

Advanced examples
nunjucks foo.tpl -p src -o dist -O nj.json

Compiles src/foo.tpl to dist/foo.html, with nj.json as nunjucks environnement options.

nunjucks *.tpl data.json -w -p src

Compiles all .tpl files (except ones starting with _) in the src folder to the current working directory, with data.json as metadata, and keeps running in the background for files changes.

Keywords

FAQs

Last updated on 22 Jun 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc