Skip to content

Commit

Permalink
feat(processor-utils): Add index to ClassNameSlugVars (#63)
Browse files Browse the repository at this point in the history
* feat(processor-utils): Add `index` to ClassNameSlugVars

* update docs

---------

Co-authored-by: Neo Nie <gongwu.nie@revolut.com>
  • Loading branch information
nihgwu and Neo Nie authored Mar 1, 2024
1 parent 9d7cb05 commit aa1ca75
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/few-dolphins-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wyw-in-js/processor-utils': minor
'@wyw-in-js/shared': minor
---

Add `index` to ClassNameSlugVars
2 changes: 1 addition & 1 deletion apps/website/pages/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ module.exports = {
Would generate the class name `.absdjfsdf__42__header`.
Last argument `args` is an object that contains following properties: `title`, `hash`, `dir`, `ext`, `file`, `name`. These properties
Last argument `args` is an object that contains following properties: `title`, `hash`, `index`, `dir`, `ext`, `file`, `name`. These properties
are useful when you want to generate your own hash:
```js
Expand Down
1 change: 1 addition & 0 deletions packages/processor-utils/src/utils/getClassNameAndSlug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function getClassNameAndSlug(
const slugVars: ClassNameSlugVars = {
hash: slug,
title: displayName,
index: idx,
file: relativeFilename,
ext,
name: basename(relativeFilename, ext),
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/options/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type ClassNameSlugVars = {
ext: string;
file: string;
hash: string;
index: number;
name: string;
title: string;
};
Expand Down

0 comments on commit aa1ca75

Please sign in to comment.