New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

swig-dummy-context

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swig-dummy-context

given a swig template, create a dummy context which is useful for template composing tools

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

swig-dummy-context

Given a swig template, produce a dummy context that you can immediately use to preview your template.

See also swig-email-templates

Example Usage

Contents of template.html:

<div>
  {{ description }}
</div>
{% if articles %}
  <ul>
  {% for article in articles %}
    <li>{{ article.name }}</li>
  {% endfor %}
  </ul>
{% else %}
  <p>{{ defaultText }}</p>
{% endif %}
var swig = require('swig')
  , createDummyContext = require('swig-dummy-context')

swig.init({
  allowErrors: true,
  root: path.join(__dirname, "templates"),
});
var template = swig.compileFile("template.html");
assert.deepEqual(createDummyContext(template), {
  "description": "description",
  "articles": {
    "name": "name",
  },
  "defaultText": "defaultText"
});

Keywords

email

FAQs

Package last updated on 29 Jan 2013

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