yihui / xaringan

Presentation Ninja 幻灯忍者 · 写轮眼
https://slides.yihui.org/xaringan/
Other
1.49k stars 280 forks source link

css bundling/minifying by netlify causes google font not displaying correctly. #141

Closed tcgriffith closed 6 years ago

tcgriffith commented 6 years ago

I've run into a similar problem like this SO question:

When I deployed xaringan slides with netlify, the css files(default.css and default-fonts.css) were bundled into one. Fonts were incorrect. But when I chose not to bundle and minify the css in netlify, Fonts were correctly displayed.I eye-checked the bundled css and the unprocessed css, they are the same.

As an example, Here is the source file of my slides

Correct deploy

Incorrect deploy

Any idea why this happened? Should we always avoid bundling &minifying css?

tcgriffith commented 6 years ago

Ah nevermind, found it:

@import rule must be at the top of the document

yihui commented 6 years ago

Does it work if you put the font CSS before other CSS files?

output:
  xaringan::moon_reader:
    css: ["default-fonts", "default"]
tcgriffith commented 6 years ago

It worked.

I found that netlify would bundle css files by default, which also messed up my blogdown site's css files.

I think this issue should be made aware of for those who use netlify for deployment.

yihui commented 6 years ago

Feel free to add this information somewhere in the wiki (you may create a new page if necessary): https://github.com/yihui/xaringan/wiki

tcgriffith commented 6 years ago

I drafted a new page to address this issue:

https://github.com/yihui/xaringan/wiki/Tips-for-Deploying-Your-Slides-Online

yihui commented 6 years ago

Excellent. Thanks!