using font-face in meteor?

2019-02-12 14:20发布

问题:

I am trying to use CSS @font-face in meteor, but for some reason it isn't working:

@font-face {
    font-family: printFailed; 
    src:
    url("../public/fonts/wlm_print_failed.ttf"),
    url("../public/fonts/wlm_print_failed.eot");
}

I've checked my paths and spelling.

When I inspect the element in the browser it appears that the filepaths and names are correct, but that the browser is substituting a generic font instead of the intended custom font.

Any pointers? Thanks.

回答1:

Just use / as everything in public becomes the root directory from the point of view of the web browser:

@font-face {
    font-family: printFailed; 
    src:
    url("/fonts/wlm_print_failed.ttf"),
    url("/fonts/wlm_print_failed.eot");
}