stlite icon indicating copy to clipboard operation
stlite copied to clipboard

Custom components can not load font files

Open whitphx opened this issue 3 years ago • 1 comments

For example, streamlit_aggrid.

Currently the script tags and stylesheet link tags are handled as below. Font files also should be done so.

  • https://github.com/whitphx/stlite/blob/96141203eb7b7509476a6431809eedff744d127a/packages/kernel/src/react-helpers/CustomComponentIFrame/iframe-manipulation.ts#L12
  • https://github.com/whitphx/stlite/blob/96141203eb7b7509476a6431809eedff744d127a/packages/kernel/src/react-helpers/CustomComponentIFrame/iframe-manipulation.ts#L52

whitphx avatar Dec 05 '22 09:12 whitphx

In the AGGrid example, the font files are specified in inline style tags with URLs like the following.

...
@font-face{font-display:swap;font-family:Source Sans Pro;font-style:normal;font-weight:400;src:url(../../static/media/source-sans-pro-cyrillic-ext-400-normal.de95c5209ef26bf69ccf.woff2) format("woff2"),url(../../static/media/source-sans-pro-all-400-normal.1882629b5eaf2ec74fbf.woff) format("woff");unicode-range:u+0460-052f,u+1c80-1c88,u+20b4,u+2de0-2dff,u+a640-a69f,u+fe2e-fe2f}
...

So, the current mechanism may not work well. -> #201 is needed? -> -> But relative paths do not work on it?

whitphx avatar Dec 06 '22 07:12 whitphx