Skip to content

Commit e637bfb

Browse files
committed
Address feedback.
1 parent 80abb72 commit e637bfb

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

core-build/gulp-core-build-sass/src/CSSModules.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ export default class CSSModules implements ICSSModules {
2828
/**
2929
* CSSModules includes the source file's path relative to the project root
3030
* as part of the class name hashing algorithm.
31-
* This should be configured with `buildConfig.rootPath` for SassTask, but
32-
* will default the process' current working dir.
31+
* This should be configured with the setting:
32+
* {@link @microsoft/gulp-core-build#IBuildConfig.rootPath}
33+
* That is used in {@link ./SassTask#SassTask}
34+
* But will default the process' current working dir.
3335
*/
3436
constructor(rootPath?: string) {
3537
this._classMap = {};
@@ -58,7 +60,8 @@ export default class CSSModules implements ICSSModules {
5860
protected generateScopedName(name: string, fileName: string, css: string)
5961
: string {
6062
const fileBaseName: string = path.relative(this._rootPath, fileName);
61-
const hash: string = crypto.createHmac('sha1', fileBaseName)
63+
const safeFileBaseName: string = fileBaseName.replace(/\\/g, '/');
64+
const hash: string = crypto.createHmac('sha1', safeFileBaseName)
6265
.update(css)
6366
.digest('hex')
6467
.substring(0, 8);

0 commit comments

Comments
 (0)