Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aptoma/dredition-layout

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aptoma/dredition-layout

Functions to render a DrEdition layout

  • 1.4.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

DrEdition layout

Functions to render a DrEdition layout

Installation

npm install @aptoma/dredition-layout

Usage

A single template string

const layout = require('@aptoma/dredition-layout');

const groups = [
	{title: 'Group 1'},
	{title: 'Group 2'}
];

const templateString = `<div>
	{% for group in groups %}
		<h1>{{ group.title }}</h1>
	{% endfor %}
</div>`;

layout.renderString(template, data)
	.then((html) => {
		console.log('Result:', html);
	});

JSON/object templates

const templateObject = {
	'parent.html': '<h1>Groups</h1>{% block groups %}{% endblock %}',
	'index.html': `
{% extends 'parent.html'}

{% block groups %}
	<div>
		{% for group in groups %}
			<h1>{{ group.title }}</h1>
		{% endfor %}
	</div>
{% endblock %}`,
};

layout.renderJsonTemplate(template, data)
	.then((html) => {
		console.log('Result:', html);
	});

FAQs

Package last updated on 03 Mar 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc