nunjucks-component-extension
support pass data for nunjucks widget
Last updated 3 years ago by hacke2 .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install nunjucks-component-extension 
SYNC missed versions from official npm registry.

nunjucks-component-extension

nunjucks plugin for pass data

install

npm install nunjucks-component-extension --save

use case

const nunjucks = require('nunjucks');
const env = new nunjucks.configure(config.cwd);

env.addExtension('ComponentExtension', require('nunjucks-component-extension'));

nunjucks.render('index.html', (err, str) => {
    console.log(str);
})

ex.

index.html:

<html>
<head>
	<title>test component</title>
</head>
<body>
	{%
		set obj = {
			name: 'Michael',
			corp: 'Alibaba',
			dep: '神马搜索'
		}
	%}

	{% component file="sub.html", obj%}
</body>
</html>

sub.html:

<p>姓名: {{name}}</p>
<p>公司: {{corp}}</p>

Current Tags

  • 0.0.7                                ...           latest (3 years ago)

7 Versions

  • 0.0.7                                ...           3 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (2)
Downloads
Today 0
This Week 1
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (1)
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |