File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -43,16 +43,20 @@ export function enforceThemePlugin(theme) {
43
43
transform ( context ) {
44
44
let { body } = context ;
45
45
46
- if ( context . response . is ( 'html' ) && ( theme === 'base' || theme === 'ported-lumo' ) ) {
47
- // Load the base theme
48
- body = body . replace ( './common.js' , './common-base.js' ) ;
46
+ if ( theme === 'legacy-lumo' && context . response . is ( 'html' , 'js' ) ) {
47
+ body = body . replace ( 'vaadin-lumo-styles/global.css' , 'vaadin-lumo-styles/test/autoload.js' ) ;
49
48
}
50
49
51
- if ( context . response . is ( 'html ', 'js' ) && ( theme === 'base' || theme === 'legacy-lumo ') ) {
52
- // Remove all CSS imports
50
+ if ( [ 'base ', 'legacy-lumo' ] . includes ( theme ) && context . response . is ( 'html' , 'js ') ) {
51
+ // Remove all not transformed CSS imports
53
52
body = body . replaceAll ( / ^ .+ v a a d i n - l u m o - s t y l e s \/ .+ \. c s s .+ $ / gmu, '' ) ;
54
53
}
55
54
55
+ if ( [ 'base' , 'ported-lumo' ] . includes ( theme ) && context . response . is ( 'html' ) ) {
56
+ // Load the base theme
57
+ body = body . replace ( './common.js' , './common-base.js' ) ;
58
+ }
59
+
56
60
return body ;
57
61
} ,
58
62
transformImport ( { source } ) {
@@ -62,10 +66,6 @@ export function enforceThemePlugin(theme) {
62
66
source = source . replace ( / ( .+ ) - c o r e - s t y l e s \. j s / u, '$1-base-styles.js' ) ;
63
67
}
64
68
65
- if ( theme === 'legacy-lumo' ) {
66
- source = source . replace ( 'vaadin-lumo-styles/global.css' , 'vaadin-lumo-styles/test/autoload.js' ) ;
67
- }
68
-
69
69
return source ;
70
70
} ,
71
71
} ;
You can’t perform that action at this time.
0 commit comments