{"id":16788733,"url":"https://github.com/markmead/alpinejs-slug","last_synced_at":"2025-03-22T00:33:03.369Z","repository":{"id":52377875,"uuid":"461034849","full_name":"markmead/alpinejs-slug","owner":"markmead","description":"Transform a string into a slug with Alpine JS and Slugify 🐌","archived":false,"fork":false,"pushed_at":"2024-04-04T10:49:06.000Z","size":39,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-14T08:24:38.384Z","etag":null,"topics":["alpine-js","alpinejs","alpinejs-plugin","javascript","slug","slugify"],"latest_commit_sha":null,"homepage":"https://js.hyperui.dev/examples/form-input-slug","language":"JavaScript","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/markmead.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-18T23:21:54.000Z","updated_at":"2023-10-17T13:48:46.000Z","dependencies_parsed_at":"2023-01-26T05:46:51.696Z","dependency_job_id":null,"html_url":"https://github.com/markmead/alpinejs-slug","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmead%2Falpinejs-slug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmead%2Falpinejs-slug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmead%2Falpinejs-slug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmead%2Falpinejs-slug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markmead","download_url":"https://codeload.github.com/markmead/alpinejs-slug/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221820901,"owners_count":16886225,"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":["alpine-js","alpinejs","alpinejs-plugin","javascript","slug","slugify"],"created_at":"2024-10-13T08:24:33.160Z","updated_at":"2024-10-28T11:27:20.339Z","avatar_url":"https://github.com/markmead.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Alpine JS Slug\n\nTransform a string into a slug with Alpine JS and\n[Slugify](https://www.npmjs.com/package/slugify) 🐌\n\n## Install\n\n### With a CDN\n\n```html\n\u003cscript\n  defer\n  src=\"https://unpkg.com/alpinejs-slug@latest/dist/slug.min.js\"\n\u003e\u003c/script\u003e\n\n\u003cscript defer src=\"https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js\"\u003e\u003c/script\u003e\n```\n\n### With a Package Manager\n\n```shell\nnpm i -D alpinejs-slug\n\nyarn add -D alpinejs-slug\n```\n\n```js\nimport Alpine from 'alpinejs'\nimport slug from 'alpinejs-slug'\n\nAlpine.plugin(slug)\n\nAlpine.start()\n```\n\n## Example\n\n```html\n\u003cdiv x-data=\"{ articleTitle: ' Alpine JS! ♥ ' }\"\u003e\n  \u003cinput type=\"text\" id=\"articleTitle\" x-model=\"articleTitle\" /\u003e\n\n  \u003cinput type=\"text\" id=\"articleSlug\" x-slug=\"articleTitle\" /\u003e\n  \u003c!-- This results in \"alpine-js-love\" --\u003e\n\n  \u003cp x-slug.keep-case.not-strict.replacement.\u0026=\"articleTitle\"\u003e\u003c/p\u003e\n  \u003c!-- This results in \"Alpine\u0026JS!\u0026love\" --\u003e\n\n  \u003cp x-slug.untrimmed=\"articleTitle\"\u003e\u003c/p\u003e\n  \u003c!-- This results in \"-alpine-js-love-\" --\u003e\n\n  \u003cp x-slug.locale.de=\"articleTitle\"\u003e\u003c/p\u003e\n  \u003c!-- This results in \"alpine-js-liebe\" --\u003e\n\u003c/div\u003e\n```\n\n### Modifiers\n\n#### `keep-case`\n\nDefault: `false`\n\n| Modifier  | Value       | False       | True        |\n| --------- | ----------- | ----------- | ----------- |\n| keep-case | Hello World | hello-world | Hello-World |\n\n#### `replacement`\n\nDefault: `-`\n\nIf you wanted to use an underscore you'd do so like this `replacement._`\n\n#### `not-strict`\n\nDefault: `false`\n\n| Modifier   | Value        | False       | True         |\n| ---------- | ------------ | ----------- | ------------ |\n| not-strict | Hello World! | hello-world | hello-world! |\n\n#### `untrimmed`\n\nDefault: `false`\n\nIf this modifier is added and the string contains spaces, the spaces will be\nreplaced with the value of `replacement`.\n\n#### `locale`\n\nDefault: `{}`\n\nSet the locale to change how certain characters are transformed. You can see the\nlist on the\n[Slugify repo](https://github.com/simov/slugify/blob/master/config/locales.json).\n\n#### `lazy`\n\nPrevents the `x-slug` input value changing on load. It will only change when the\ninput `x-slug` is targeting changes.\n\n### Stats\n\n![](https://img.shields.io/bundlephobia/min/alpinejs-slug)\n![](https://img.shields.io/npm/v/alpinejs-slug)\n![](https://img.shields.io/npm/dt/alpinejs-slug)\n![](https://img.shields.io/github/license/markmead/alpinejs-slug)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkmead%2Falpinejs-slug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkmead%2Falpinejs-slug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkmead%2Falpinejs-slug/lists"}