@@ -44,16 +44,22 @@ class Vasri
44
44
*/
45
45
private $ vasriConfig ;
46
46
47
+ /**
48
+ * @var
49
+ */
50
+ private $ isMixManifestAltEnabled ;
51
+
47
52
/**
48
53
* Vasri constructor.
49
54
*/
50
55
public function __construct ()
51
56
{
52
- $ this ->builder = new Builder ();
53
- $ this ->manifestReader = new ManifestReader ();
54
- $ this ->vasriConfig = config ('vasri ' );
55
- $ this ->vasriManifest = $ this ->manifestReader ->getManifest (base_path ('vasri-manifest.json ' ));
56
- $ this ->appEnvironment = env ('APP_ENV ' , 'production ' );
57
+ $ this ->builder = new Builder ();
58
+ $ this ->manifestReader = new ManifestReader ();
59
+ $ this ->vasriConfig = config ('vasri ' );
60
+ $ this ->isMixManifestAltEnabled = $ this ->vasriConfig ['mix-manifest-alt ' ];
61
+ $ this ->vasriManifest = $ this ->manifestReader ->getManifest (base_path ('vasri-manifest.json ' ));
62
+ $ this ->appEnvironment = env ('APP_ENV ' , 'production ' );
57
63
}
58
64
59
65
/**
@@ -76,6 +82,8 @@ public function vasri(
76
82
): string {
77
83
if (self ::isPublicFile ($ file )) {
78
84
85
+ $ this ->checkFileName ($ file );
86
+
79
87
return $ this ->addAttributes ($ file , $ enableVersioning , $ enableSRI , $ keyword );
80
88
81
89
} else {
@@ -100,6 +108,18 @@ private function getSRI(string $file, string $keyword): string
100
108
return sprintf ('integrity="%s" %s ' , $ this ->vasriManifest [$ file ]['sri ' ], $ this ->builder ->crossOrigin ($ keyword ));
101
109
}
102
110
111
+ /**
112
+ * @param string $file
113
+ */
114
+ private function checkFileName (string &$ file ): void
115
+ {
116
+ if ($ this ->isMixManifestAltEnabled ) {
117
+
118
+ $ file = $ this ->vasriManifest [$ file ]['alt ' ];
119
+
120
+ }
121
+ }
122
+
103
123
/**
104
124
* Builds all the attributes
105
125
*
0 commit comments