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

lit-nunjucks

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lit-nunjucks

Nunjucks compiler to lit-html

  • 1.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

lit-nunjucks

Compile https://mozilla.github.io/nunjucks/ templates into standar lit-html.

Quickstart

Install the library

npm install lit-nunjucks
const { compile } = require('lit-nunjucks')

Givend the input

{% if authorized %} 
Hello {{customer.name}}
{% endif %}

It will generate

function template({
  authorized
}) {
  return authorized && html`Hello ${customer.name}`;
}

Why

Templates are backend tecnologies, Usually sever renders a template once with a given values. If use a template into a full front end app, everytime our data state change we have to re apply the template. This behaviout is costly and there are such a good alternatives there in order to performatly update the DOM with a new state (React, Vue, lit-html).

  • Sometimes you dont want expose all js power to a template developer
  • Templates are simpler to learn than learn advance es6 syntax
  • You might not want to access globals in your templates such as window

This project attempts to bring best of both worlds. Use jinja style templates into a front end app performatly.

Do I need this?

Probably you don't.

Keywords

FAQs

Package last updated on 16 Aug 2023

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