karma icon indicating copy to clipboard operation
karma copied to clipboard

Feature Request: Add way to preload assets in karma config.

Open darrnshn opened this issue 5 years ago • 4 comments

Karma config allows you to specify included=true to let karma include the asset for you. It would be great if karma also allowed you to optionally specify that the include should have the preload attribute.

darrnshn avatar Apr 22 '20 00:04 darrnshn

Please describe the problem, which this feature would resolve?

devoto13 avatar May 25 '20 13:05 devoto13

We have some assets that we would like to include in our test HTML page. We need to set the preload attribute on those includes. Because of this, we cannot use Karma config to include these assets automatically anymore, we have to manually inject the assets into the test page via JS.

darrnshn avatar May 28 '20 03:05 darrnshn

Can you provide an example? Are we talking about rel="preload"? AFAICT it is a purely performance thing and should not prevent you from including assets? Or am I missing something?

You can also use type="dom" in files configuration to include arbitrary content into the test page.

devoto13 avatar May 28 '20 07:05 devoto13

Thanks, yes I was referring to rel="preload". It should be a pure performance thing.

We can use type="dom" for a workaround.

darrnshn avatar Jun 01 '20 23:06 darrnshn