Open philwolstenholme opened 4 years ago
Btw, You may not need loadCSS…, by Filament Group.
Another approach, without dependencies will be:
<script>
const media = window.matchMedia('(min-width: 1024px)')
if (media.matches) {
const desktopCSS = document.createElement('link');
desktopCSS.rel = 'stylesheet';
desktopCSS.href = '/css/desktop.css';
document.getElementsByTagName('head')[0].appendChild(desktopCSS);
}
</script>
See #27
The code examples might be too opinionated perhaps, but I think they might be useful to show the HTML only approach vs the more dynamic approach.