Socket
Socket
Sign inDemoInstall

pug-loader

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

pug-loader

Pug loader module for Webpack


Version published
Weekly downloads
39K
decreased by-7.32%
Maintainers
1
Weekly downloads
 
Created
Source

Pug loader for Webpack

Usage

var template = require("pug!./file.pug");
// => returns file.pug content as template function

var locals = { /* ... */ };

var html = template(locals);
// => the rendered HTML

For more information on how to use Webpack loaders, check the official documentation.

Legacy .jade files

pug-loader fully supports .jade files. Just use pug-loader with .jade files as you would with a .pug file.

Options

The following options are available to be set as part of the loader query. They are all mapped directly to Pug options, unless pointed out otherwise.

  • doctype
    • Unlike Pug, it defaults to "html" if not set
  • globals
  • self
  • plugins
    • Note that you cannot specify any Pug plugins implementing read or resolve hooks, as those are reserved for the loader
  • pretty
  • root
    • Webpack uses its own file resolving mechanism, so while it is functionally equivalent to the Pug option with the same name, it is implemented differently

Embedded resources

Try to use require for all your embedded resources, to process them with webpack.

div
  img(src=require("./my/image.png"))

Remember, you need to configure loaders for these file types too. You might be interested in the file loader.

License

MIT

FAQs

Package last updated on 25 Jul 2016

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