Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

40 строки
1.1 KiB

  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. 'use strict';
  8. const loaderUtils = require('loader-utils');
  9. module.exports = function getLocalIdent(
  10. context,
  11. localIdentName,
  12. localName,
  13. options
  14. ) {
  15. // Use the filename or folder name, based on some uses the index.js / index.module.(css|scss|sass) project style
  16. const fileNameOrFolder = context.resourcePath.match(
  17. /index\.module\.(css|scss|sass)$/
  18. )
  19. ? '[folder]'
  20. : '[name]';
  21. // Create a hash based on a the file location and class name. Will be unique across a project, and close to globally unique.
  22. const hash = loaderUtils.getHashDigest(
  23. context.resourcePath + localName,
  24. 'md5',
  25. 'base64',
  26. 5
  27. );
  28. // Use loaderUtils to find the file or folder name
  29. const className = loaderUtils.interpolateName(
  30. context,
  31. fileNameOrFolder + '_' + localName + '__' + hash,
  32. options
  33. );
  34. // remove the .module that appears in every classname when based on the file.
  35. return className.replace('.module_', '_');
  36. };