{"id":18666337,"url":"https://github.com/docpad/docpad-plugin-partials","last_synced_at":"2025-04-11T23:32:43.208Z","repository":{"id":5092282,"uuid":"6254807","full_name":"docpad/docpad-plugin-partials","owner":"docpad","description":"Adds support for Partials (re-usable templates) to DocPad.","archived":false,"fork":false,"pushed_at":"2024-02-05T21:18:11.000Z","size":340,"stargazers_count":29,"open_issues_count":22,"forks_count":13,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-04-26T01:43:12.831Z","etag":null,"topics":["docpad-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"julianduque/erlang-color","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docpad.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["balupton"],"patreon":"bevry","open_collective":"bevry","ko_fi":"balupton","liberapay":"bevry","custom":["https://bevry.me/fund"]}},"created_at":"2012-10-17T02:02:39.000Z","updated_at":"2024-06-18T18:26:38.179Z","dependencies_parsed_at":"2024-06-18T18:37:36.631Z","dependency_job_id":null,"html_url":"https://github.com/docpad/docpad-plugin-partials","commit_stats":{"total_commits":95,"total_committers":7,"mean_commits":"13.571428571428571","dds":0.08421052631578951,"last_synced_commit":"e5e165cab93c49982a257fe5d83d4133f7fcb986"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-partials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-partials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-partials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-partials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docpad","download_url":"https://codeload.github.com/docpad/docpad-plugin-partials/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248495487,"owners_count":21113643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docpad-plugin"],"created_at":"2024-11-07T08:31:52.413Z","updated_at":"2025-04-11T23:32:38.186Z","avatar_url":"https://github.com/docpad.png","language":"JavaScript","funding_links":["https://github.com/sponsors/balupton","https://patreon.com/bevry","https://opencollective.com/bevry","https://ko-fi.com/balupton","https://liberapay.com/bevry","https://bevry.me/fund","https://buymeacoffee.com/balupton"],"categories":[],"sub_categories":[],"readme":"\u003c!-- TITLE/ --\u003e\n\n\u003ch1\u003ePartials Plugin for DocPad\u003c/h1\u003e\n\n\u003c!-- /TITLE --\u003e\n\n\n\u003c!-- BADGES/ --\u003e\n\n\u003cspan class=\"badge-travisci\"\u003e\u003ca href=\"http://travis-ci.com/docpad/docpad-plugin-partials\" title=\"Check this project's build status on TravisCI\"\u003e\u003cimg src=\"https://img.shields.io/travis/com/docpad/docpad-plugin-partials/master.svg\" alt=\"Travis CI Build Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-npmversion\"\u003e\u003ca href=\"https://npmjs.org/package/docpad-plugin-partials\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/docpad-plugin-partials.svg\" alt=\"NPM version\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-npmdownloads\"\u003e\u003ca href=\"https://npmjs.org/package/docpad-plugin-partials\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/docpad-plugin-partials.svg\" alt=\"NPM downloads\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-daviddm\"\u003e\u003ca href=\"https://david-dm.org/docpad/docpad-plugin-partials\" title=\"View the status of this project's dependencies on DavidDM\"\u003e\u003cimg src=\"https://img.shields.io/david/docpad/docpad-plugin-partials.svg\" alt=\"Dependency Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-daviddmdev\"\u003e\u003ca href=\"https://david-dm.org/docpad/docpad-plugin-partials#info=devDependencies\" title=\"View the status of this project's development dependencies on DavidDM\"\u003e\u003cimg src=\"https://img.shields.io/david/dev/docpad/docpad-plugin-partials.svg\" alt=\"Dev Dependency Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cbr class=\"badge-separator\" /\u003e\n\u003cspan class=\"badge-githubsponsors\"\u003e\u003ca href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-flattr\"\u003e\u003ca href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"\u003e\u003cimg src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-liberapay\"\u003e\u003ca href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"\u003e\u003cimg src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-opencollective\"\u003e\u003ca href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"\u003e\u003cimg src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-crypto\"\u003e\u003ca href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"\u003e\u003cimg src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-paypal\"\u003e\u003ca href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-wishlist\"\u003e\u003ca href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"\u003e\u003cimg src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n\u003c!-- /BADGES --\u003e\n\n\nThis plugin provides [DocPad](https://docpad.org) with Partials. Partials are documents which can be inserted into other documents, and are also passed by the docpad rendering engine.\n\n## Usage\n\nCreate the `src/partials` directory, and place any partials you want to use in there.\n\nThen call the new `partial(filename, objs...)` template helper to include the partial. The object arguments are optional, and can be used to send custom data to the partial's template data. Setting the first object argument to `false` will not send over the template data by default.\n\n### Examples\n\nLets say we have the partial `src/partials/hello.html.eco` that includes:\n\n```html\nHello \u003c%=@name or 'World'%\u003e Welcome to \u003c%= @site?.name or 'My Site' %\u003e\n```\n\nAnd a [docpad configuration file](http://docpad.org) file that includes:\n\n```coffee\ntemplateData:\n\tsite:\n\t\tname: \"Ben's Awesome Site\"\n```\n\nWe could then render via a `src/documents/index.html.eco` document in these different ways:\n\n```html\n\u003c!-- Include the rendered contents of `src/partials/my-partial` file --\u003e\n\u003c!-- and send over the template data --\u003e\n\u003c%- @partial('hello') %\u003e\n\u003c!-- gives us:\nHello World\nWelcome to Ben's Awesome Site\n--\u003e\n\n\u003c!-- Include the rendered contents of `src/partials/my-partial` file --\u003e\n\u003c!-- and send over the template data --\u003e\n\u003c!-- and send over our own custom template data --\u003e\n\u003c%- @partial('hello', {name:'Ben'}) %\u003e\n\u003c!-- gives us:\nHello Ben\nWelcome to Ben's Awesome Site\n--\u003e\n\n\u003c!-- Include the rendered contents of `src/partials/my-partial` file --\u003e\n\u003c!-- and DO NOT send over the template data --\u003e\n\u003c%- @partial('hello', false) %\u003e\n\u003c!-- gives us:\nHello World\nWelcome to My Site\n--\u003e\n\n\u003c!-- Include the rendered contents of `src/partials/my-partial` file --\u003e\n\u003c!-- and DO NOT send over the template data --\u003e\n\u003c!-- and send over ONLY our own custom template data --\u003e\n\u003c%- @partial('hello', false, {name:'Ben'}) %\u003e\n\u003c!-- gives us:\nHello Ben\nWelcome to My Site\n--\u003e\n\n\u003c!-- Include the rendered contents of `src/partials/my-partial` file --\u003e\n\u003c!-- and DO NOT send over the template data --\u003e\n\u003c!-- and send over our own custom template data with the template data site property --\u003e\n\u003c%- @partial('hello', false, {site:{name:@site.name}}, {name:'Ben'}) %\u003e\n\u003c!-- gives us:\nHello Ben\nWelcome to Ben's Awesome Site\n--\u003e\n```\n\n### Notes\n\nTo increase performance it is recommended you only include the exact template data variables that you need - this is because sending over all the template data can be a costly process as we much destroy all references (do a deep clone) to avoid reference conflicts and over-writes between each render - so sending over as little / as specific data as possible means less reference destroying which means faster processing.\n\nIf your partial only needs to be rendered once per (re)generation then you can specify `cacheable: true` in the partial's meta data, doing so greatly improves performance.\n\nPartials actually render asynchronously, when you call `\u003c%- @partial('hello') %\u003e` you'll actually get back something a temporary placeholder like `[partial:0.1290219301293]` while your template is rendering, then once your template has rendered, and once all the partials have rendered, we will then go through and replace these placeholder values with the correct content. We must do this as template rendering is a synchronous process whereas document rendering is an asynchronous process. [More info here.](https://github.com/docpad/docpad-plugin-partials/issues/12)\n\n### Compatibility\n\n-   Versions 2.8.0 and above DO send the template data by default. You can turn this off by using `false` as the first object argument or by setting `performanceFirst: true` in your plugin's configuration options.\n\n-   Versions below 2.8.0 DO NOT send the template data by default. You must add it by using `@` or `this` as the first object argument like so: `\u003c%- @partial('my-partial', @) %\u003e`\n\n\u003c!-- INSTALL/ --\u003e\n\n\u003ch2\u003eInstall\u003c/h2\u003e\n\nInstall this DocPad plugin by entering \u003ccode\u003edocpad install partials\u003c/code\u003e into your terminal.\n\n\u003c!-- /INSTALL --\u003e\n\n\n\u003c!-- HISTORY/ --\u003e\n\n\u003ch2\u003eHistory\u003c/h2\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-partials/blob/master/HISTORY.md#files\"\u003eDiscover the release history by heading on over to the \u003ccode\u003eHISTORY.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /HISTORY --\u003e\n\n\n\u003c!-- CONTRIBUTE/ --\u003e\n\n\u003ch2\u003eContribute\u003c/h2\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-partials/blob/master/CONTRIBUTING.md#files\"\u003eDiscover how you can contribute by heading on over to the \u003ccode\u003eCONTRIBUTING.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /CONTRIBUTE --\u003e\n\n\n\u003c!-- BACKERS/ --\u003e\n\n\u003ch2\u003eBackers\u003c/h2\u003e\n\n\u003ch3\u003eMaintainers\u003c/h3\u003e\n\nThese amazing people are maintaining this project:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"https://github.com/balupton\"\u003eBenjamin Lupton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-partials/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository docpad/docpad-plugin-partials\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003ch3\u003eSponsors\u003c/h3\u003e\n\nNo sponsors yet! Will you be the first?\n\n\u003cspan class=\"badge-githubsponsors\"\u003e\u003ca href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-flattr\"\u003e\u003ca href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"\u003e\u003cimg src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-liberapay\"\u003e\u003ca href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"\u003e\u003cimg src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-opencollective\"\u003e\u003ca href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"\u003e\u003cimg src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-crypto\"\u003e\u003ca href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"\u003e\u003cimg src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-paypal\"\u003e\u003ca href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-wishlist\"\u003e\u003ca href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"\u003e\u003cimg src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n\u003ch3\u003eContributors\u003c/h3\u003e\n\nThese amazing people have contributed code to this project:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"https://github.com/balupton\"\u003eBenjamin Lupton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-partials/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository docpad/docpad-plugin-partials\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://takitapart.com\"\u003eBob VanderClay\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/bobvanderclay\"\u003eBob VanderClay\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-partials/commits?author=bobvanderclay\" title=\"View the GitHub contributions of Bob VanderClay on repository docpad/docpad-plugin-partials\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/Delapouite\"\u003eBruno Heridet\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-partials/commits?author=Delapouite\" title=\"View the GitHub contributions of Bruno Heridet on repository docpad/docpad-plugin-partials\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/iredmedia\"\u003eKevin Redman\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-partials/commits?author=iredmedia\" title=\"View the GitHub contributions of Kevin Redman on repository docpad/docpad-plugin-partials\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/patocallaghan\"\u003ePat O'Callaghan\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-partials/commits?author=patocallaghan\" title=\"View the GitHub contributions of Pat O'Callaghan on repository docpad/docpad-plugin-partials\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/patuf\"\u003epatuf\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-partials/commits?author=patuf\" title=\"View the GitHub contributions of patuf on repository docpad/docpad-plugin-partials\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/vsopvsop\"\u003evsopvsop\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-partials/commits?author=vsopvsop\" title=\"View the GitHub contributions of vsopvsop on repository docpad/docpad-plugin-partials\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-partials/blob/master/CONTRIBUTING.md#files\"\u003eDiscover how you can contribute by heading on over to the \u003ccode\u003eCONTRIBUTING.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /BACKERS --\u003e\n\n\n\u003c!-- LICENSE/ --\u003e\n\n\u003ch2\u003eLicense\u003c/h2\u003e\n\nUnless stated otherwise all works are:\n\n\u003cul\u003e\u003cli\u003eCopyright \u0026copy; 2012+ \u003ca href=\"http://bevry.me\"\u003eBevry Pty Ltd\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\nand licensed under:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"http://spdx.org/licenses/MIT.html\"\u003eMIT License\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003c!-- /LICENSE --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocpad%2Fdocpad-plugin-partials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocpad%2Fdocpad-plugin-partials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocpad%2Fdocpad-plugin-partials/lists"}