use custom kebabcase function
This commit is contained in:
parent
6f90fc50db
commit
fdda4c2042
@ -1,5 +1,5 @@
|
||||
import Link from 'next/link'
|
||||
import kebabCase from 'just-kebab-case'
|
||||
import { kebabCase } from '@/lib/utils'
|
||||
|
||||
const Tag = ({ text }) => {
|
||||
return (
|
||||
|
@ -1,7 +1,7 @@
|
||||
import fs from 'fs'
|
||||
import matter from 'gray-matter'
|
||||
import path from 'path'
|
||||
import kebabCase from 'just-kebab-case'
|
||||
import { kebabCase } from './utils'
|
||||
|
||||
const root = process.cwd()
|
||||
|
||||
|
6
lib/utils.js
Normal file
6
lib/utils.js
Normal file
@ -0,0 +1,6 @@
|
||||
export const kebabCase = (str) =>
|
||||
str &&
|
||||
str
|
||||
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
|
||||
.map((x) => x.toLowerCase())
|
||||
.join('-')
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -5646,11 +5646,6 @@
|
||||
"object.assign": "^4.1.2"
|
||||
}
|
||||
},
|
||||
"just-kebab-case": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/just-kebab-case/-/just-kebab-case-1.1.0.tgz",
|
||||
"integrity": "sha512-QkuwuBMQ9BQHMUEkAtIA4INLrkmnnveqlFB1oFi09gbU0wBdZo6tTnyxNWMR84zHxBuwK7GLAwqN8nrvVxOLTA=="
|
||||
},
|
||||
"katex": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/katex/-/katex-0.12.0.tgz",
|
||||
|
@ -19,7 +19,6 @@
|
||||
"autoprefixer": "^10.1.0",
|
||||
"gray-matter": "^4.0.2",
|
||||
"image-size": "0.9.3",
|
||||
"just-kebab-case": "^1.1.0",
|
||||
"next": "10.0.5",
|
||||
"next-mdx-remote": "^2.0.0",
|
||||
"next-seo": "4.17.0",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import kebabCase from 'just-kebab-case'
|
||||
import siteMetadata from '@/data/siteMetadata'
|
||||
import { kebabCase } from '@/lib/utils'
|
||||
import { getAllTags } from '@/lib/tags'
|
||||
import Tag from '@/components/Tag'
|
||||
import Link from '@/components/Link'
|
||||
|
@ -1,6 +1,6 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import kebabCase from 'just-kebab-case'
|
||||
import { kebabCase } from '@/lib/utils'
|
||||
import { getAllFilesFrontMatter } from '@/lib/mdx'
|
||||
import { getAllTags } from '@/lib/tags'
|
||||
import siteMetadata from '@/data/siteMetadata'
|
||||
|
Loading…
x
Reference in New Issue
Block a user