Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dazzlingfugu/ember-slugify
Library to slugify your strings within Ember.
https://github.com/dazzlingfugu/ember-slugify
ember ember-addon hacktoberfest slug slugify
Last synced: 4 months ago
JSON representation
Library to slugify your strings within Ember.
- Host: GitHub
- URL: https://github.com/dazzlingfugu/ember-slugify
- Owner: DazzlingFugu
- License: mit
- Created: 2019-01-24T11:54:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-24T07:51:16.000Z (4 months ago)
- Last Synced: 2024-09-27T00:05:31.157Z (4 months ago)
- Topics: ember, ember-addon, hacktoberfest, slug, slugify
- Language: JavaScript
- Homepage:
- Size: 3.8 MB
- Stars: 5
- Watchers: 25
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# ember-slugify
[![CI](https://github.com/DazzlingFugu/ember-slugify/actions/workflows/ci.yml/badge.svg)](https://github.com/DazzlingFugu/ember-slugify/actions/workflows/ci.yml) [![Ember Observer Score](https://emberobserver.com/badges/ember-slugify.svg)](https://emberobserver.com/addons/ember-slugify) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Library to slugify your strings within Ember.
This library uses:
- [slugify](https://github.com/simov/slugify)
- [simple-pinyin](https://github.com/xuqingkuang/simple-pinyin)
- [emoji.json](https://github.com/amio/emoji.json)## Compatibility
- Ember.js v4.8 or above
- Embroider or ember-auto-import v2## Installation
```
ember install ember-slugify
```## Usage
### In a `js` file
```js
import slugify, { removeDiacritics } from 'ember-slugify'let slug = slugify('Le Théâtre')
// le-theatreslug = slugify('I ♥ New York')
// i-love-new-yorkslug = slugify("Vive l'♥", { locale: 'fr' })
// vive-lamourslug = slugify('bonjour monsieur', { replacement: '#' })
// bonjour#monsieurslug = slugify('你好你怎么样 monsieur', { pinyin: true })
// ni-hao-ni-zen-me-yang-monsieurslug = slugify('🇫🇷❤️🥖➕🍷', { emoji: true })
// flag-france-red-heart-baguette-bread-plus-wine-glasslet noDiacritics = removeDiacritics('Le Théâtre')
// Le Theatre
```### In a template
```hbs
{{slugify 'Le Théâtre'}}{{slugify '你好你怎么样 monsieur' (hash pinyin=true)}}
{{slugify '🇫🇷❤️🥖➕🍷' (hash emoji=true)}}
{{remove-diacritics 'Le Théâtre'}}
```The separator option is not available on `slugify` helper.
### Options
| name | description | default value |
| ----------- | -------------------------------------------------------------- | ------------- |
| replacement | replace spaces with replacement character | `'-'` |
| lower | convert to lower case | `true` |
| locale | language code of the locale to use | `undefined` |
| trim | trim leading and trailing replacement chars | `true` |
| pinyin | replace chinese by latin character following the pinyin method | `false` |
| emoji | replace unicode emoji by it's description | `false` |## Contributing
See the [Contributing](CONTRIBUTING.md) guide for details.
## Contributors
MrChocolatine
GreatWizard
saintsebastian
BlueCutOfficial
mathieupoteriepeopledoc
romgere
## License
This project is licensed under the [MIT License](LICENSE.md).