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

@types/pug

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/pug

TypeScript definitions for pug

  • 2.0.10
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/pug?

@types/pug provides TypeScript type definitions for the Pug template engine, allowing developers to use Pug with TypeScript more effectively by providing type safety and autocompletion features.

What are @types/pug's main functionalities?

Compile Pug templates to HTML

This feature allows you to compile Pug templates into HTML strings. The code sample demonstrates compiling a simple Pug template with a variable and rendering it to HTML.

const pug = require('pug');
const compiledFunction = pug.compile('p Hello, #{name}!');
const html = compiledFunction({ name: 'World' });
console.log(html); // Output: <p>Hello, World!</p>

Render Pug templates with data

This feature allows you to render Pug templates directly with data. The code sample shows how to render a Pug template with a variable passed in as data.

const pug = require('pug');
const html = pug.render('p Hello, #{name}!', { name: 'World' });
console.log(html); // Output: <p>Hello, World!</p>

Compile Pug templates to a function

This feature allows you to compile Pug templates from a file into a reusable function. The code sample demonstrates compiling a Pug template file and rendering it with data.

const pug = require('pug');
const compiledFunction = pug.compileFile('template.pug');
const html = compiledFunction({ name: 'World' });
console.log(html); // Output depends on the content of template.pug

Other packages similar to @types/pug

FAQs

Package last updated on 21 Nov 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