{"name":"pug-runtime","version":"3.0.0-canary-1","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-1","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-ifbBYo2iel7dQL4t2Tr/m+WMk5oo6cx0Ba6TvyRTWtT/o82FjEXAGeWtZHoknZN7yW9zbTDLxyRwE4qiKR9Vwg==","shasum":"b4fe04da780dd1165acaa32c5ac6c1faf7824e4d","tarball":"http://registry-npm.ywwl.com/pug-runtime/download/pug-runtime-3.0.0-canary-1.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\nwsFcBAEBCAAQBQJeyv5ACRA9TVsSAnZWagAAJFYP/37jwpRI3bUrMbF7gWxR\nuOvJE8+KeV0CY1FE9FdYCXuYVWvkZkzVL381Lv3bZFCw/z5663pXJWnb5u11\nokG0lSur/iu83Frz8zItN4SEWFLESJCV/6hCoHVrX9Nhat//C8Z5AZ66Awfq\nQ8VjvUFHwyHJ4ZMrL8HOjJlTZVX8eNsIGm2GlFYk1t7u53P5DqHov0ZlDta3\nW3LeDGWtvaJv64VK27Bp1xbsu+WH8jfU74xaLNGK9Iql3UPCGkrPb1L3Gk7c\nSd8lzT0P8+HpJt/TGF+Ca68AAOEoYB/XTZHr0gt3CFI2hAVpo1NyrTThbv2x\nHQcFrA1wDdZHcXIWGfqB1uBxDeOjyO8XsSc6qcjYRWe7vhRiq1Qr24nhzqYa\nnPX3o/friJb7+DwcKRgPdFPzNAQSPuwxKjZt0n1suaZhFGZI4CIFVCe//j5U\nZadDSLlTi7/KO6tVxw0NBM3CxXBpn9Q088jNmGpV/U15GSnrLU8Ic6CWUddB\n+pG/HhiltQZ2joXFioiU/BmuH+atdnHcv9ve5DA/DrKvRduxWbYttTvOGas2\nCxvenhev+p+m5A8NcyVezGJfv+4dB4bo4lt0qLSrvSy2LzfYQz31gK0XMUpX\nni3odFFKSgJ5WRi5EfBiqJxn/FYxHxW04E86wIvxEMVdHn4XO+wzJuNezL6W\niJhR\r\n=A/yW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDfVtwsbhMQsqqKODIYXaFbpnPYlAo0JjMHDbeggLHmggIgSn8KKcz7rjFYzkpgHx76wE2Hb1Yk60jcEvNGQCFcS2s="}],"size":6463,"noattachment":false,"key":"/pug-runtime/-/pug-runtime-3.0.0-canary-1.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-1_1590361664389_0.7419930035905624"},"_hasShrinkwrap":false,"publish_time":1590361664505,"_cnpm_publish_time":1590361664505,"dist-tags":{"canary":"3.0.1-canary-10","latest":"3.0.1"}}