{"name":"pug-runtime","version":"3.0.0-canary-2","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.0-canary-2","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-jZZKokZoMbMH2fUHU/IgNRgMU+I/USpmTQupdzHKvRlCM+6HnT2zybCzRKISMmOtYOy3VgHcAcLUA/rs4cgUCw==","shasum":"da86b7845f5597d8ec1669a0520d6d31f8459015","tarball":"http://registry-npm.ywwl.com/pug-runtime/download/pug-runtime-3.0.0-canary-2.tgz","fileCount":10,"unpackedSize":16725,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJey7eiCRA9TVsSAnZWagAAxxIP/245/pWHqChOiHre39d0\nRYpdCeG4SONExb0BdMgGjHzYeViI9sZIeNmq57+KNx+aSwhvKBnRh28mnYVh\n9GgrpID0iy8YQk0gywB4S8wHIqFF/8jPEcIPyU+WLqNsxl0IF21KY7Qnn+0c\nkkbqDzzuwfWK85XY3Y42g1KZLvAqiKpHUytjWCIbDW9xyO2kdoyz29bkMoh/\n2Pl0fhaDAaw4ZmJi3Hb8PYeho+r6/wzUeaHvOKkrBuLusjmfmPVZj6YYcZjw\ndr/lE75rWBpX2Qb3xaJoBZ1d8Ff0/+HgvE9ppFeMIPaqeN2SQvnOtxeB/Ofc\nVC5hVlr4SiMBXRydKnMNT3HYbZ13mXotrwLLqfVB0cZ1jUQRBplf1vKA/edZ\n8iLZejkzIfyS4Nau0URBHiOM+4XELyLoXOGyWlRNwzM7rvJxhGrxgS0PdGTq\nyMZhc3g1URvEq9r+tAVfQ5gWPrn0gTR1Tl5pizBVl02oBmdCkGmnmucWKifU\nSsjd/KTqX7UZ/tmMdySbCcRrpiJGQWxqHA+ulJifnVmP75690QWEBHfya68I\nPpGqfi0OFOe6B5A/0AQrlroavB0J7vCRVLgrMdU5EetQCEP4jE8TyGY9ua5v\nVEBkIDC2xH0LLRtn5yyrv1btegkWwyd/zDx4Esl4OhrYb4V7mqqeAAh6s8Cp\nZvx/\r\n=2/Gh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHwoeTl4Tb2TNvk9EWEUIEJuYdCXbq/P334XJmcmw/UzAiAXKADX5Zi1ybebPzcqsn6bRt9NAMHKcFaSQk/PUmUR+Q=="}],"size":6463,"noattachment":false,"key":"/pug-runtime/-/pug-runtime-3.0.0-canary-2.tgz"},"maintainers":[{"email":"forbes@lindesay.co.uk","name":"forbeslindesay"},{"email":"pug-bot@rollingversions.com","name":"pug-bot"},{"email":"timothygu99@gmail.com","name":"timothygu"}],"_npmUser":{"name":"pug-bot","email":"pug-bot@rollingversions.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pug-runtime_3.0.0-canary-2_1590409122162_0.8471950643689525"},"_hasShrinkwrap":false,"publish_time":1590409122397,"_cnpm_publish_time":1590409122397,"dist-tags":{"canary":"3.0.1-canary-10","latest":"3.0.1"}}