File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,29 @@ string as the second argument of the ``StaticVersionStrategy`` constructor::
139
139
echo $package->getUrl('image.png');
140
140
// result: v1/image.png
141
141
142
+ JSON File Manifest
143
+ ..................
144
+
145
+ Use the :class: `Symfony\\ Component\\ Asset\\ VersionStrategy\\ JsonManifestVersionStrategy `
146
+ to take advantage of the strategy used by popular tools such as `Webpack
147
+ <https://webpack.js.org/> `_, which generate a JSON file mapping all source file names to their corresponding output file. For example::
148
+
149
+ // rev-manifest.json
150
+ {
151
+ "css/app.css": "build/css/app.b916426ea1d10021f3f17ce8031f93c2.css",
152
+ "js/app.js": "build/js/app.13630905267b809161e71d0f8a0c017b.js"
153
+ "...": "..."
154
+ }
155
+
156
+
157
+ use Symfony\C omponent\A sset\P ackage;
158
+ use Symfony\C omponent\A sset\V ersionStrategy\J sonManifestVersionStrategy;
159
+
160
+ $package = new Package(new JsonManifestVersionStrategy(__DIR__'./rev-manifest.json'));
161
+
162
+ echo $package->getUrl('css/app.css');
163
+ // result: build/css/app.b916426ea1d10021f3f17ce8031f93c2.css
164
+
142
165
Custom Version Strategies
143
166
.........................
144
167
You can’t perform that action at this time.
0 commit comments