{"id":15633768,"url":"https://github.com/danielroe/vue-bind-once","last_synced_at":"2025-04-05T15:06:27.477Z","repository":{"id":37016479,"uuid":"462276737","full_name":"danielroe/vue-bind-once","owner":"danielroe","description":"A tiny, SSR-safe directive for binding random data to an element.","archived":false,"fork":false,"pushed_at":"2024-04-13T19:53:19.000Z","size":2742,"stargazers_count":149,"open_issues_count":5,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-13T20:45:35.978Z","etag":null,"topics":["directive","ssr","vue"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielroe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-02-22T11:56:51.000Z","updated_at":"2024-04-15T03:26:06.810Z","dependencies_parsed_at":"2024-04-13T20:49:08.208Z","dependency_job_id":null,"html_url":"https://github.com/danielroe/vue-bind-once","commit_stats":{"total_commits":266,"total_committers":4,"mean_commits":66.5,"dds":0.0864661654135338,"last_synced_commit":"dd8e13febfc653f98f0c1ddfacde7f071468cc94"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Fvue-bind-once","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Fvue-bind-once/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Fvue-bind-once/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielroe%2Fvue-bind-once/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielroe","download_url":"https://codeload.github.com/danielroe/vue-bind-once/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353745,"owners_count":20925329,"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":["directive","ssr","vue"],"created_at":"2024-10-03T10:50:11.071Z","updated_at":"2025-04-05T15:06:27.440Z","avatar_url":"https://github.com/danielroe.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003e1️⃣ vue-bind-once\u003c/h1\u003e\n\u003cp align=\"center\"\u003eA tiny, SSR-safe directive for binding random data to an element.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://npmjs.com/package/vue-bind-once\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/npm/v/vue-bind-once/latest.svg?style=flat-square\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://bundlephobia.com/result?p=vue-bind-once\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/bundlephobia/minzip/vue-bind-once?style=flat-square\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://npmjs.com/package/vue-bind-once\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/npm/dt/vue-bind-once.svg?style=flat-square\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://lgtm.com/projects/g/danielroe/vue-bind-once\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/lgtm/alerts/github/danielroe/vue-bind-once?style=flat-square\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://lgtm.com/projects/g/danielroe/vue-bind-once\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/lgtm/grade/javascript/github/danielroe/vue-bind-once?style=flat-square\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/danielroe/vue-bind-once\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/codecov/c/github/danielroe/vue-bind-once.svg?style=flat-square\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003e A tiny, SSR-safe directive for binding random data to an element.\n\n## Quick Start\n\nFirst install `vue-bind-once`:\n\n```bash\nyarn add vue-bind-once\n\n# or npm\n\nnpm install vue-bind-once --save\n```\n\n### Register directive\n\n```ts\nimport { createApp } from 'vue'\nimport { BindOnceDirective, BindOncePlugin } from 'vue-bind-once'\nimport App from './App.vue'\n\nconst app = createApp(App)\napp.use(BindOncePlugin)\n// or app.directive('bind-once', BindOnceDirective)\n```\n\nIn most cases you'll be using this directive with an SSR-rendering framework like `nuxt`, which may have a different way for you to register this directive. For example, in a Nuxt plugin:\n\n```js\nimport { BindOncePlugin } from 'vue-bind-once'\n\nexport default defineNuxtPlugin((nuxtApp) =\u003e {\n  nuxtApp.vueApp.use(BindOncePlugin)\n})\n```\n\n### Usage\n\nYou can now use the directive on any element where you need a binding to a value that needs to match between client/server but won't change dynamically afterwards.\n\n```html\n\u003cscript setup\u003e\n  import { nanoid } from 'nanoid'\n  const id = nanoid()\n\u003c/script\u003e\n\u003ctemplate\u003e\n  \u003cinput type=\"text\" v-bind-once=\"{ id, name: id }\" /\u003e\n  \u003clabel v-bind-once=\"{ for: id }\" /\u003e\n\u003c/template\u003e\n```\n\nThis will work on both server and on client re-hydration.\n\n## Contributors\n\nThis has been developed to suit my needs but additional use cases and contributions are very welcome.\n\n## License\n\n[MIT License](./LICENSE) - Copyright \u0026copy; Daniel Roe\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielroe%2Fvue-bind-once","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielroe%2Fvue-bind-once","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielroe%2Fvue-bind-once/lists"}