Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly package loadCSS and cssrelpreload using webpack 2?

I'm trying to package filamentgroup/loadCSS using webpack 2 but I fail to do so. I'd like to get cssrelpreload.js executed in the browser so it preloads CSS files for browsers which do not support rel="preload".

I've tried using imports-loader and exports-loader to have window.loadCSS available for cssrelpreload.js but I'm unable configure it correctly.

I was able to get window available for loadCSS.js, but that doesn't help to get cssrelpreload.js executed correctly.

How would I need to configure webpack to get this packaged correctly?

like image 468
thasmo Avatar asked Apr 21 '26 01:04

thasmo


1 Answers

Try the following code

import { loadCSS } from 'fg-loadcss';
loadCSS( 'style.css' );
like image 172
Vladimir Yazykov Avatar answered Apr 23 '26 16:04

Vladimir Yazykov