@@ -52,6 +52,41 @@ public function __construct(ResolverInterface $fallback, AssetMinification $mini
52
52
*/
53
53
public function resolve ($ type , $ file , $ area = null , ThemeInterface $ theme = null , $ locale = null , $ module = null )
54
54
{
55
+ $ fileExtension = pathinfo ($ file , PATHINFO_EXTENSION );
56
+
57
+ if ($ fileExtension === 'js ' ) {
58
+ return $ this ->resolveJsMinification ($ type , $ file , $ area , $ theme , $ locale , $ module );
59
+ }
60
+
61
+ // Leave BC way of resolving
62
+ $ path = $ this ->fallback ->resolve ($ type , $ file , $ area , $ theme , $ locale , $ module );
63
+
64
+ if (!$ path && $ file != ($ newFile = $ this ->minification ->removeMinifiedSign ($ file ))) {
65
+ $ path = $ this ->fallback ->resolve ($ type , $ newFile , $ area , $ theme , $ locale , $ module );
66
+ }
67
+
68
+ return $ path ;
69
+ }
70
+
71
+ /**
72
+ * Get path of file after using fallback rules
73
+ *
74
+ * @param string $type
75
+ * @param string $file
76
+ * @param string|null $area
77
+ * @param ThemeInterface|null $theme
78
+ * @param string|null $locale
79
+ * @param string|null $module
80
+ * @return string|false
81
+ */
82
+ private function resolveJsMinification (
83
+ $ type ,
84
+ $ file ,
85
+ $ area = null ,
86
+ ThemeInterface $ theme = null ,
87
+ $ locale = null ,
88
+ $ module = null
89
+ ) {
55
90
$ path = $ this ->fallback ->resolve ($ type , $ file , $ area , $ theme , $ locale , $ module );
56
91
57
92
/**
@@ -64,7 +99,7 @@ public function resolve($type, $file, $area = null, ThemeInterface $theme = null
64
99
/**
65
100
* If minification is disabled - return already found path
66
101
*/
67
- if (!$ this ->minification ->isEnabled (pathinfo ( $ file , PATHINFO_EXTENSION ) )) {
102
+ if (!$ this ->minification ->isEnabled (' js ' )) {
68
103
return $ path ;
69
104
}
70
105
0 commit comments