mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-01 22:38:10 +08:00
Update getCSSModuleLocalIdent to support Sass (#4391)
* Update getCSSModuleLocalIdent to support Sass * Fix Sass/SCSS index module tests Also make them more consistent with the non-index variants.
This commit is contained in:
@@ -15,8 +15,10 @@ module.exports = function getLocalIdent(
|
||||
localName,
|
||||
options
|
||||
) {
|
||||
// Use the filename or folder name, based on some uses the index.js / index.module.css project style
|
||||
const fileNameOrFolder = context.resourcePath.endsWith('index.module.css')
|
||||
// Use the filename or folder name, based on some uses the index.js / index.module.(css|scss|sass) project style
|
||||
const fileNameOrFolder = context.resourcePath.match(
|
||||
/index\.module\.(css|scss|sass)$/
|
||||
)
|
||||
? '[folder]'
|
||||
: '[name]';
|
||||
// Create a hash based on a the file location and class name. Will be unique across a project, and close to globally unique.
|
||||
|
||||
Reference in New Issue
Block a user