Socket
Socket
Sign inDemoInstall

@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


Version published
Maintainers
1
Created

Package description

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

Readme

Source

Installation

npm install --save @types/pug

Summary

This package contains type definitions for pug (https://github.com/pugjs/pug).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pug.

Additional Details

  • Last updated: Thu, 23 Dec 2021 23:35:19 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by TonyYang.

FAQs

Package last updated on 24 Dec 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc