Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e78ebd3

Browse files
Allow generic-names hashPrefix option
1 parent bfdbee5 commit e78ebd3

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

‎README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ hook({
230230
});
231231
```
232232

233+
### `hashPrefix` string
234+
235+
Short alias for the [generic-names](https://github.com/css-modules/generic-names) helper option.
236+
Provides additional hash uniqueness. Might be useful for projects with several stylesheets sharing a same name.
237+
233238
### `mode` string
234239

235240
Short alias for the [postcss-modules-local-by-default](https://github.com/css-modules/postcss-modules-local-by-default) plugin's option.

‎lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module.exports = function setupHook({
3434
prepend = [],
3535
createImportedName,
3636
generateScopedName,
37+
hashPrefix,
3738
mode,
3839
use,
3940
rootDir: context = process.cwd(),
@@ -51,7 +52,7 @@ module.exports = function setupHook({
5152
let scopedName;
5253
if (generateScopedName) {
5354
scopedName = typeof generateScopedName !== 'function'
54-
? genericNames(generateScopedName, {context}) // for example '[name]__[local]___[hash:base64:5]'
55+
? genericNames(generateScopedName, {context, hashPrefix}) // for example '[name]__[local]___[hash:base64:5]'
5556
: generateScopedName;
5657
} else {
5758
// small fallback

‎lib/validate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const rules = {
1717
use: 'array',
1818
createImportedName: 'function',
1919
generateScopedName: 'function|string',
20+
hashPrefix: 'string',
2021
mode: 'string',
2122
rootDir: 'string',
2223
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /