Getting Katex fonts to load with Rails Asset Pipeline

前端 未结 3 1944
长情又很酷
长情又很酷 2021-01-28 11:21

I\'m integrating the Katex math formula rendering library into a Rails 3.2 app but the font assets keep returning a 404 error message:



        
3条回答
  •  孤城傲影
    2021-01-28 11:35

    It turns out that all of the assets are compiled into the public/assets directory instead of being separated like public/assets/fonts, which is what Katex is expecting.

    However, subdirectories of these "main" directories are retained so I moved the Katex fonts to the following directory instead:

    vendor/assets/fonts/fonts/
    

    Now the public/assets directory contains a fonts directory and the path /assets/fonts/KaTeX_Math-Italic.woff gets served just fine.

    I don't like having a fonts/fonts directory so let me know if there's a more elegant way to solve this that doesn't involve manipulating the third party JS or CSS assets.

提交回复
热议问题