{"name":"pug-runtime","version":"3.0.1-canary-10","description":"The runtime components for the pug templating language","keywords":["pug"],"devDependencies":{"uglify-js":"^2.6.1"},"scripts":{"prepublish":"node prepublish","pretest":"npm run prepublish","build":"node prepublish"},"repository":{"type":"git","url":"https://github.com/pugjs/pug/tree/master/packages/pug-runtime"},"browser":{"fs":false},"author":{"name":"ForbesLindesay"},"license":"MIT","readme":"# pug-runtime\n\nThe runtime components for the pug templating language\n\n[![Build Status](https://img.shields.io/travis/pugjs/pug-runtime/master.svg)](https://travis-ci.org/pugjs/pug-runtime)\n[![Dependencies Status](https://david-dm.org/pugjs/pug/status.svg?path=packages/pug-runtime)](https://david-dm.org/pugjs/pug?path=packages/pug-runtime)\n[![DevDependencies Status](https://david-dm.org/pugjs/pug/dev-status.svg?path=packages/pug-runtime)](https://david-dm.org/pugjs/pug?path=packages/pug-runtime&type=dev)\n[![NPM version](https://img.shields.io/npm/v/pug-runtime.svg)](https://www.npmjs.org/package/pug-runtime)\n\n## Installation\n\n    npm install pug-runtime\n\n## Usage\n\n\nYou can call runtime methods directly using `runtime.method`.  This is particularly useful when compiling to deal with things that are already known at compile time.\n\n```js\nvar runtime = require('pug-runtime');\n\nassert(runtime.attr('foo', 'bar', true, true) === ' foo=\"bar\"');\n```\n\nYou can also build a string with a given list of functions available as `pug_method` by calling `build(arrayOfMethods)`.  This is useful for inlining runtime functions within the compiled templates.\n\n```js\nvar build = require('pug-runtime/build');\nvar src = build(['attr']);\n\nvar attr = Function('', src + ';return pug_attr;')();\nassert(attr('foo', 'bar', true, true) === ' foo=\"bar\"');\n```\n\nWhen testing code compiled for the browser in Node.js, it is necessary to make the runtime available. To do so, one can use `require('pug-runtime/wrap')`:\n\n```js\nvar pug = require('pug');\nvar wrap = require('pug-runtime/wrap');\n\nvar pugSrc = 'p= content';\n// By default compileClient automatically embeds the needed runtime functions,\n// rendering this module useless.\nvar compiledCode = pug.compileClient(pugSrc, {\n  externalRuntime: true\n});\n//=> 'function template (locals) { ... pug.escape() ... }'\n\nvar templateFunc = wrap(compiledCode);\ntemplateFunc({content: 'Hey!'});\n//=> '<p>Hey!</p>'\n\n// Change template function name to 'heyTemplate'\ncompiledCode = pug.compileClient(pugSrc, {\n  externalRuntime: true,\n  name: 'heyTemplate'\n});\n//=> 'function heyTemplate (locals) { ... }'\n\ntemplateFunc = wrap(compiledCode, 'heyTemplate');\ntemplateFunc({content: 'Hey!'});\n//=> '<p>Hey!</p>'\n```\n\n\n## License\n\n  MIT\n","readmeFilename":"README.md","_id":"pug-runtime@3.0.1-canary-10","_nodeVersion":"12.20.2","_npmVersion":"6.14.11","dist":{"integrity":"sha512-aZ0DNBgyAmj+tcs3yKrqsLrKJpUyLle4EqlHpJXmb98vtAj7v3KcPXV3h5hAfSz60qb3r1YIHrFKHkjZUdtenw==","shasum":"890e448a1eed2bbcae9b5d8e566ab7cd47680e4c","tarball":"http://registry-npm.ywwl.com/pug-runtime/download/pug-runtime-3.0.1-canary-10.tgz","fileCount":10,"unpackedSize":16962,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgO+9YCRA9TVsSAnZWagAAeLEP/2lifp7JyyP7ddCPWb6s\nSsEcPx+9KLZxEPaag/k9kWlcliZXbzLI4XjkRlhK6sEBpwdJ/Jp3A3jaQ5Y9\nhXsR1E1tYiZaTiuDWc7br/BMOxwRX4xWntoGQL9/ctRU2TsJsCCm3Fmfx+sT\nqQKbwdwqf7z4BfVYf2alO2PpwLtLKnfCoCpaXtcwjd+KPUrHudRImSmN9YAv\ntGMMcG3G+8Mvk0D14RoYeGG914CqhBDbPCpKalQDg2tCuUyN2ADiumFGWFux\nlR2+Mx9gjeKF4pHZnz2FpowtPVrp/rxWLeGnMu4o6smpkJf2/LKA8v1iADnb\nh98Apk8acDzm1rt9eOrZrqzWGeFsEcdeF+tBWSjNiWqgVG4XjOkI2foggPVq\nA5/dFeTyhpMEXNIteWb9FU6Z17OTRzM1B2HLeeYpo3yNHNdfcpaVFjxRRvCR\norzsX7eKRhWn3xdQNN4VU5jKLKsAVJmef4J2L+VW+G7X64d/1bUo3AU2X8rH\npRRuZ9GGTCQ/xyj7lv9j54ET7JrGIcGK6KiyeJpd+w59nqqfRCnSKiGjhWHv\nt2yvh6SON6mL0lHASutsQCWmq7bS64z1oCr72HoqrvS1mMkFwMZ989eTjJJe\nt3Ov+xbkzMgWVN9X1yyDOnEugwj4ZSOY7Q0pY6dR28evN4M8PNHoNEYzT7ZM\ntQfP\r\n=ywn6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnkYqijhXL/rmJfVL1gsZJbVO2SiUuOv5JEpgXszdzHgIhANwLxnMUBLCLFPOf61agrIy9BBKLOS15blfPeRP1swD7"}],"size":6547,"noattachment":false,"key":"/pug-runtime/-/pug-runtime-3.0.1-canary-10.tgz"},"_npmUser":{"name":"pug-bot","email":"pug-bot@rollingversions.com"},"directories":{},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},{"name":"pug-bot","email":"pug-bot@rollingversions.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pug-runtime_3.0.1-canary-10_1614540632259_0.5675034579855938"},"_hasShrinkwrap":false,"publish_time":1614540632389,"_cnpm_publish_time":1614540632389,"dist-tags":{"canary":"3.0.1-canary-10","latest":"3.0.1"}}