MinificationPlugin.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Plugin\View;
  6. use \Magento\Framework\View\Asset\Minification;
  7. /**
  8. * MinificationPlugin
  9. *
  10. * @package Temando\Shipping\Plugin
  11. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  12. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  13. * @link http://www.temando.com/
  14. */
  15. class MinificationPlugin
  16. {
  17. /**
  18. * Exclude static componentry files from being minified.
  19. *
  20. * Using the config node `minify_exclude` is not an option because it does
  21. * not get merged but overridden by subsequent modules.
  22. *
  23. * @see \Magento\Framework\View\Asset\Minification::XML_PATH_MINIFICATION_EXCLUDES
  24. *
  25. * @param Minification $subject
  26. * @param string[] $excludes
  27. * @param string $contentType
  28. * @return string[]
  29. */
  30. public function afterGetExcludes(Minification $subject, array $excludes, $contentType)
  31. {
  32. if ($contentType !== 'js') {
  33. return $excludes;
  34. }
  35. $excludes[]= '/Temando_Shipping/static/js/';
  36. return $excludes;
  37. }
  38. }