bootstrap-loader icon indicating copy to clipboard operation
bootstrap-loader copied to clipboard

Is there anyway to load the bootstrap css inline on server side rendering development mode?

Open idangozlan opened this issue 7 years ago • 9 comments

idangozlan avatar Mar 01 '17 16:03 idangozlan

@idangozlan can you provide some more details of why you want to do this?

justin808 avatar Mar 05 '17 08:03 justin808

Cause i don't like the first seconds when the CSS hasn't loaded yet,i would like to have it inline in the HTML body as part of the response

On Mar 5, 2017 10:43, "Justin Gordon" [email protected] wrote:

@idangozlan https://github.com/idangozlan can you provide some more details of why you want to do this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shakacode/bootstrap-loader/issues/277#issuecomment-284214107, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5hbbDWA6j7mbqGi5jnrpwGmv7iRz66ks5rinWggaJpZM4MP6Bu .

idangozlan avatar Mar 05 '17 08:03 idangozlan

I'm also curious

danyim avatar May 04 '17 17:05 danyim

Setting extractStyles to false in .bootstraprc did it for me.

ERPedersen avatar May 07 '17 22:05 ERPedersen

@ERPedersen, @idangozlan Any chance that this should in the docs? If so, please help me with a doc PR.

justin808 avatar May 08 '17 00:05 justin808

@ERPedersen is this related to https://github.com/shakacode/bootstrap-loader/issues/276 ? I was not able to get it to work in my testing.

bherila avatar Jun 22 '17 06:06 bherila

@bherila I just ran into this after a recent Webpack upgrade. Even if you have extractStyles: false, if you also have css-loader?sourceMap in your config the styles will load in <link rel="stylesheet" href="blob:http..."> causing a delay in style loading and showing unstyled elements until the "external" stylesheet loads.

Still looking into a way to get source maps back to being inline.

ratherblue avatar Jul 17 '17 20:07 ratherblue

@ratherblue I think it's related to the source maps being unable to work without an absolute URI prefix being added at runtime.

bherila avatar Jul 17 '17 20:07 bherila

In the end I decided to just hard code bootstrap css path from the CDN and then load only my specific styles through the loader (so no more bootstrap-loader for me). This also helps reduce the size of my bundle which I've been trying to do anyway (I'm approaching 4 MB here and bootstrap ain't helping! lol)

bherila avatar Jul 17 '17 20:07 bherila