diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2024-03-09 08:57:59 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2024-03-09 08:57:59 +0530 |
| commit | f4a94bed13a8595ec8a15e3ea8315aeb5aecc744 (patch) | |
| tree | e563f1a74a657348f13999c125f5ca12d200f8e6 /config/webpack/utils/filename-hash.js | |
| parent | 435b16e29080f49e1ec373f5b0f552559ca04686 (diff) | |
| download | banglar-bhumi-utils-f4a94bed13a8595ec8a15e3ea8315aeb5aecc744.tar.gz banglar-bhumi-utils-f4a94bed13a8595ec8a15e3ea8315aeb5aecc744.zip | |
A lot of changes :)
Diffstat (limited to 'config/webpack/utils/filename-hash.js')
| -rw-r--r-- | config/webpack/utils/filename-hash.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/config/webpack/utils/filename-hash.js b/config/webpack/utils/filename-hash.js index bd66647..e0d8a6d 100644 --- a/config/webpack/utils/filename-hash.js +++ b/config/webpack/utils/filename-hash.js @@ -1,10 +1,19 @@ const crypto = require("crypto"); -module.exports.getFileNameHash = (fileName, prefix) => { - const hash = crypto +module.exports.getFileNameHash = (fileName, prefix, justHash = false) => { + let hash = crypto .createHash("md5") .update(`${prefix}-${fileName}`) .digest("hex"); - return production ? hash : `${fileName}-${hash.substring(16)}`; + if (production) { + return hash; + } else { + hash = hash.substring(16); + if (justHash) { + return hash; + } else { + return `${fileName}-${hash}`; + } + } }; |
