{"library":"pug-loader","title":"pug-loader","description":"Webpack loader for Pug (formerly Jade) templates, version 2.4.0. Compiles Pug templates to JavaScript template functions at build time. Works with webpack module bundler, supports embedded resources via require(), and can render HTML at compile time using apply-loader. Supports both .pug and legacy .jade files. Options map directly to Pug options. Requires pug ^2.0.0 as a peer dependency. A key differentiator is automatic resolution of includes and inheritance via webpack's module resolution.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install pug-loader"],"cli":null},"imports":["module.exports = { ... config: { module: { rules: [ { test: /\\.pug$/, loader: 'pug-loader' } ] } } }","var template = require('pug-loader!./file.pug');","var html = require('apply-loader!pug-loader!./file.pug');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    filename: 'bundle.js',\n    path: __dirname + '/dist'\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.pug$/,\n        loader: 'pug-loader',\n        options: {\n          doctype: 'html',\n          pretty: true\n        }\n      }\n    ]\n  }\n};\n\n// src/index.js\nvar template = require('./template.pug');\nvar html = template({ name: 'World' });\nconsole.log(html);","lang":"javascript","description":"Shows webpack configuration for pug-loader and usage in JavaScript to compile a Pug template with locals.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}