Custom fonts placed in /public are not requested or rendered in VuePress 2 #1667
              
                Unanswered
              
          
                  
                    
                      nancy1234567890
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Summary
I placed custom font files inside the /public/fonts folder and reference them in my SCSS (for example, index.scss or palette.scss) using url('/fonts/Inter-Regular.ttf').
The CSS rules appear correctly in DevTools, but the fonts never load or display in the UI.
The Network tab shows no font requests at all.
Expected Behavior
Font files inside /public/fonts should be copied to the final build and requested from
http://localhost:8080/fonts/... (or the site’s base path) when referenced with url('/fonts/...').
Actual Behavior
The DOM and computed styles correctly list the custom font-family.
The font URL appears in the compiled CSS (url("/fonts/Inter-Regular.ttf")).
No .ttf / .woff requests appear in the Network tab.
The text renders using fallback system fonts instead.
Reproduction Steps
Create /public/fonts/Inter-Regular.ttf.
Add to .vuepress/styles/fonts.scss:
@font-face {
font-family: 'Inter';
src: url('/fonts/Inter-Regular.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}
body { font-family: 'Inter', sans-serif; }
Import this file inside index.scss or wrapper.scss.
Run vuepress dev docs.
Inspect Network → no /fonts/… request.
Troubleshooting Attempted
Verified that /public/fonts/Inter-Regular.ttf exists.
Tried absolute (/fonts/...) and relative (../public/fonts/...) URLs.
Tried adding publicPath and base options in config.
Tried moving fonts to /theme/styles and referencing with ~@source/....
Fonts never appear in the network log, even though the same CSS works in plain Vue apps.
Expected Clarification
Is /public in VuePress 2 still the correct location for static font assets?
If not, what is the recommended pattern for loading custom fonts so they are copied and requested properly?
Environment
VuePress 2 RC 26
Bundler: @vuepress/bundler-webpack
Custom theme extending @vuepress/theme-default
Beta Was this translation helpful? Give feedback.
All reactions