1.6.2 • Published 2 years ago

metalsmith-twig v1.6.2

Weekly downloads
58
License
MIT
Repository
github
Last release
2 years ago

metalsmith-twig

A metalsmith Plugin for Twig based on justjohn/twig.js.

Install

  npm install metalsmith-twig

Configuration in metalsmith.json:

{
  "plugins": {
    "metalsmith-twig": {}
  }
}

Examples

Initialize (INIT):

var Metalsmith = require('metalsmith'),
	Twig = require('metalsmith-twig');

Metalsmith(__dirname)
	.use(twig())
	.build(function(err) {
		if (err) throw err;
	});

Options:

  • directory: (default: views) the directory for views.
  • global: (default: {}) global variables.
  • cache: (default: true) boolean if templatefiles cached.
  • twig: (default: undefined) overwrite the twig object.
  • allowInlineIncludes: (default: false) boolean if allow inline includes.
  • namespaces: (default: false) object with namespaces key => value (see twig.js project for more details).

Files

Source file src/index.md:

---
view: layout.html
title: The title
---
The Content

View

View views/layout.html:

<!doctype html>
<html>
	<head>
		<title>{{title}}</title>
	</head>
	<body>
		{{contents}}

		{{relativePath}}css/style.css
	</body>
</html>

Docs

Contributors

The MIT License (MIT)

1.6.2

2 years ago

1.6.0

3 years ago

1.5.0

4 years ago

1.4.0

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago