Hello … good evening! I’m experiencing a very weird problem. I have built an app with Ionic 6.12.1, Angular 10.0.8 node v.12.19. I don’t believe it is related to Angular but I’m not sure about the Ionic framework. Precisely the issue is with CSS loading. When I open the app the first time after a ionic serve the CSS does not load well (in both the web browser and the mobile device). This is how it looks:
If I do a save in VS Code just to trigger a new compile the CSS loads right and it stays like that all along. The problem manifests only the very first time the app loads:
Unfortunately in the device if it loads bad it stays bad, no refresh possible as in the browser. No error showing in the console and anywhere else. Just some weird warnings in the Chrome dev console:
and, when I do a save to trigger a compile the warnings disappear. I don’t know if the warnings are a clue, but they are the only thing that shows up when the problem manifests and disappears when problem is gone.
In the SCSS file I tried removing one by one all elements but the problem stays. Here’s the file content:
- {
–background: linear-gradient(to bottom, rgb(255, 253, 253, 1), rgba(184, 176, 169, 0.9) ), url("…/…/assets/gps.jpg") no-repeat center center fixed;
–background-size: cover;
}
ion-card-content {
text-align: justify;
font-size: 1.2em;
font-weight: 500;
color: black;
padding: 0;
}
ion-toggle {
–background: white;
–background-checked: white;
border: 2px #839788 solid;
border-radius: 25px;
–handle-background: black;
–handle-background-checked: rgb(197, 20, 20);
–handle-width: 50%;
width: 100%;
height: 45px;
–handle-spacing: 5px;
–handle-height: 100%;
margin-bottom: 10px;
text-align: center;
}
ion-toggle::before {
position: absolute;
top: 13px;
left: 15px;
content: “GPS OFF”;
font-weight: 900;
color: white;
font-size: 18px;
z-index: 1;
}
ion-toggle::after {
position: absolute;
top: 13px;
right: 15px;
font-weight: 900;
content: “GPS ON”;
color: white;
font-size: 18px;
z-index: 1;
}
I’m lost… don’t know what to look for…