@@ -196,11 +196,14 @@ public function getConfigFileRelativePath()
196
196
*/
197
197
public function getMixinsFileRelativePath ()
198
198
{
199
- $ map = $ this ->getRepositoryFilesMap (Config::MIXINS_FILE_NAME , [
200
- 'area ' => $ this ->staticContext ->getAreaCode (),
201
- 'theme ' => $ this ->staticContext ->getThemePath (),
202
- 'locale ' => $ this ->staticContext ->getLocale (),
203
- ]);
199
+ $ map = $ this ->getRepositoryFilesMap (
200
+ Config::MIXINS_FILE_NAME ,
201
+ [
202
+ 'area ' => $ this ->staticContext ->getAreaCode (),
203
+ 'theme ' => $ this ->staticContext ->getThemePath (),
204
+ 'locale ' => $ this ->staticContext ->getLocale (),
205
+ ]
206
+ );
204
207
if ($ map ) {
205
208
$ relativePath = implode ('/ ' , $ map ) . '/ ' . Config::MIXINS_FILE_NAME ;
206
209
} else {
@@ -254,11 +257,14 @@ public function getMinResolverRelativePath()
254
257
*/
255
258
public function getUrlResolverFileRelativePath ()
256
259
{
257
- $ map = $ this ->getRepositoryFilesMap (Config::URL_RESOLVER_FILE_NAME , [
258
- 'area ' => $ this ->staticContext ->getAreaCode (),
259
- 'theme ' => $ this ->staticContext ->getThemePath (),
260
- 'locale ' => $ this ->staticContext ->getLocale (),
261
- ]);
260
+ $ map = $ this ->getRepositoryFilesMap (
261
+ Config::URL_RESOLVER_FILE_NAME ,
262
+ [
263
+ 'area ' => $ this ->staticContext ->getAreaCode (),
264
+ 'theme ' => $ this ->staticContext ->getThemePath (),
265
+ 'locale ' => $ this ->staticContext ->getLocale (),
266
+ ]
267
+ );
262
268
if ($ map ) {
263
269
$ relativePath = implode ('/ ' , $ map ) . '/ ' . Config::URL_RESOLVER_FILE_NAME ;
264
270
} else {
@@ -278,6 +284,8 @@ public function getMapFileRelativePath()
278
284
}
279
285
280
286
/**
287
+ * Get path to configuration file
288
+ *
281
289
* @return string
282
290
*/
283
291
protected function getConfigFileName ()
@@ -286,19 +294,22 @@ protected function getConfigFileName()
286
294
}
287
295
288
296
/**
297
+ * Get resolver code which RequireJS fetch minified files instead
298
+ *
289
299
* @return string
290
300
*/
291
301
public function getMinResolverCode ()
292
302
{
293
- $ excludes = [];
303
+ $ excludes = [' url.indexOf(baseUrl) === 0 ' ];
294
304
foreach ($ this ->minification ->getExcludes ('js ' ) as $ expression ) {
295
305
$ excludes [] = '!url.match(/ ' . str_replace ('/ ' , '\/ ' , $ expression ) . '/) ' ;
296
306
}
297
307
$ excludesCode = empty ($ excludes ) ? 'true ' : implode ('&& ' , $ excludes );
298
308
299
309
$ result = <<<code
300
310
var ctx = require.s.contexts._,
301
- origNameToUrl = ctx.nameToUrl;
311
+ origNameToUrl = ctx.nameToUrl,
312
+ baseUrl = ctx.config.baseUrl;
302
313
303
314
ctx.nameToUrl = function() {
304
315
var url = origNameToUrl.apply(ctx, arguments);
@@ -317,6 +328,8 @@ public function getMinResolverCode()
317
328
}
318
329
319
330
/**
331
+ * Get map for given file.
332
+ *
320
333
* @param string $fileId
321
334
* @param array $params
322
335
* @return array
0 commit comments