File tree Expand file tree Collapse file tree 5 files changed +15
-5
lines changed Expand file tree Collapse file tree 5 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 27
27
"test:only" : " cross-env NODE_ENV=test jest" ,
28
28
"test:watch" : " cross-env NODE_ENV=test jest --watch" ,
29
29
"test:coverage" : " cross-env NODE_ENV=test jest --collectCoverageFrom=\" src/**/*.js\" --coverage" ,
30
- "test:manual" : " webpack-dev-server test/manual/src/index.js --open -- config test/manual/webpack.config.js" ,
30
+ "test:manual" : " webpack-dev-server test/manual/src/index.js --config test/manual/webpack.config.js" ,
31
31
"pretest" : " npm run lint" ,
32
32
"test" : " cross-env NODE_ENV=test npm run test:coverage" ,
33
33
"defaults" : " webpack-defaults"
Original file line number Diff line number Diff line change @@ -325,6 +325,7 @@ class MiniCssExtractPlugin {
325
325
source ,
326
326
'' ,
327
327
`// ${ pluginName } CSS loading` ,
328
+ `var fetchRTL = !!window['${ this . options . globalRTLFlag } '];` ,
328
329
`var cssChunks = ${ JSON . stringify ( chunkMap ) } ;` ,
329
330
'if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);' ,
330
331
'else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {' ,
@@ -333,6 +334,11 @@ class MiniCssExtractPlugin {
333
334
Template . indent ( [
334
335
`var href = ${ linkHrefPath } ;` ,
335
336
`var fullhref = ${ mainTemplate . requireFn } .p + href;` ,
337
+ 'if (fetchRTL) {' ,
338
+ Template . indent ( [
339
+ `fullhref = fullhref.replace(/\\.css/i, '.rtl.css');` ,
340
+ ] ) ,
341
+ '}' ,
336
342
'var existingLinkTags = document.getElementsByTagName("link");' ,
337
343
'for(var i = 0; i < existingLinkTags.length; i++) {' ,
338
344
Template . indent ( [
Original file line number Diff line number Diff line change 10
10
"instanceof" : " Function"
11
11
}
12
12
]
13
+ },
14
+ "globalRTLFlag" : {
15
+ "type" : " string"
13
16
}
14
17
},
15
18
"errorMessages" : {
Original file line number Diff line number Diff line change 5
5
< meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6
6
< title > mini-css-extract-plugin testcase</ title >
7
7
< meta name ="viewport " content ="width=device-width, initial-scale=1 ">
8
- < link rel ="stylesheet " type ="text/css " href ="/dist/preloaded1.css " />
8
+ < link rel ="stylesheet " type ="text/css " href ="/dist/preloaded1.client. css " />
9
9
< style >
10
10
.test {
11
11
background : lightcoral;
23
23
background : lightgreen;
24
24
}
25
25
</ style >
26
- < link rel ="stylesheet " type ="text/css " href ="/dist/main.css " />
26
+ < link rel ="stylesheet " type ="text/css " href ="/dist/main.client. css " />
27
27
</ head >
28
28
< body >
29
29
< div class ="test initial-css ">
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ module.exports = {
17
17
} ,
18
18
plugins : [
19
19
new Self ( {
20
- filename : '[name].css' ,
21
- chunkFilename : '[contenthash].css' ,
20
+ filename : '[name].client.css' ,
21
+ chunkFilename : '[name].chunk.client.css' ,
22
+ globalRTLFlag : 'rtlLanguageEnabled' ,
22
23
} ) ,
23
24
] ,
24
25
devServer : {
You can’t perform that action at this time.
0 commit comments