postcss-extract-media-query icon indicating copy to clipboard operation
postcss-extract-media-query copied to clipboard

Include more performance benefit info in the README

Open philwolstenholme opened this issue 5 years ago • 1 comments
trafficstars

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.

philwolstenholme avatar May 08 '20 15:05 philwolstenholme

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>

nucliweb avatar Jul 15 '20 15:07 nucliweb