Skip to content

Commit ad38bd3

Browse files
authored
SASS: module css hash should be changed when css content changes. (microsoft#103)
* Updating hash code. * Adding change file.
1 parent 8f914bc commit ad38bd3

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/gulp-core-build-sass",
5+
"comment": "Updating SASS hash generation for css modules to consider css content in addition to filename.",
6+
"type": "patch"
7+
}
8+
],
9+
"email": "dzearing@users.noreply.github.com"
10+
}

‎gulp-core-build-sass/src/SassTask.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,12 @@ export class SassTask extends GulpTask<ISassTaskConfig> {
241241
_classMaps[cssFileName] = json;
242242
}
243243

244-
private generateScopedName(name: string, fileName: string): string {
244+
private generateScopedName(name: string, fileName: string, css: string): string {
245245
/* tslint:disable:typedef */
246246
const crypto = require('crypto');
247247
/* tslint:enable:typedef */
248248

249-
return name + '_' + crypto.createHmac('sha1', fileName).update(name).digest('hex').substring(0, 8);
249+
return name + '_' + crypto.createHmac('sha1', fileName).update(css).digest('hex').substring(0, 8);
250250
}
251251
}
252252

0 commit comments

Comments
 (0)