https://github.com/palmabit-it/loopback-ds-slugify-mixin
Loopback Slugify Mixin
https://github.com/palmabit-it/loopback-ds-slugify-mixin
loopback mixin mixins nodejs slug slugify
Last synced: 9 months ago
JSON representation
Loopback Slugify Mixin
- Host: GitHub
- URL: https://github.com/palmabit-it/loopback-ds-slugify-mixin
- Owner: Palmabit-IT
- License: mit
- Created: 2018-06-19T16:20:15.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T00:24:09.000Z (over 4 years ago)
- Last Synced: 2025-06-26T21:10:14.507Z (12 months ago)
- Topics: loopback, mixin, mixins, nodejs, slug, slugify
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 6
- Watchers: 6
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
loopback-ds-slugify-mixin
=============
# Install
```bash
npm i @palmabit/loopback-ds-slugify-mixin --save
```
# Server Config
Add the `mixins` property to your `server/model-config.json`:
```json
{
"_meta": {
"sources": [
"loopback/common/models",
"loopback/server/models",
"../common/models",
"./models"
],
"mixins": [
"loopback/common/mixins",
"../node_modules/@palmabit/loopback-ds-slugify-mixin",
"../common/mixins"
]
}
}
```
# Model Config
To use with your Models add the `mixins` attribute to the definition object of your model config.
```json
{
"name": "Widget",
"properties": {
"name": {
"type": "string",
}
},
"mixins": {
"Slugify": {
"slugifyOptions": {
"replacement": "=",
"remove": null,
"lower": true,
"suffixTimestamp": true
},
"slugifiedField": "slug",
"fieldToSlugify": "name"
}
}
}
```
- **slugifyOptions**: Optional. See https://github.com/simov/slugify for more infos
- **slugifiedField**: [String] Optional. Default is "slug". Support dot notation (ex. "foo.bar") for nested
- **fieldToSlugify**: [String] Required. Support dot notation (ex. "foo.bar") for nested
- **suffixTimestamp**: [Boolean] Optional
# Changelog
[Changelog File](CHANGELOG.md)
# License
The MIT License (MIT). Please see [License File](LICENSE) for more information.