Wrong path fonts
See original GitHub issueWhen I include semantic or bootstrap in my main.js I end up with a 404 not found error for the fonts
Apparently, the output path of fonts go to the root of my web server like this
http://localhost/build/fonts/icons.woff2
Issue Analytics
- State:
- Created 6 years ago
- Comments:41 (12 by maintainers)
Top Results From Across the Web
Wrong path font not working - Stack Overflow
I've use the font face but it seems that I'm missing something on the declaration. How should i declare to make my font...
Read more >Typeface self hosted font wrong path? - Foundry - Elixir Support
A possible bug with Typeface: may be a wrong path when using Self hosted font on 2nd child-level page. Works fine Inside Rapidweaver...
Read more >Fontawesome with webpack and Laravel 5.4, wrong path to ...
I want to get some fonts loaded to my app, but I have just issues. Before I used gulp and everything worked fine....
Read more >Wrong font URL Loading - WordPress.org
The issue in that URL is the /home1/syncrion/public_html/ , that is the full path to my site from the old host, and wouldn't...
Read more >Wrong path to font directory - Mobirise Forums
I think I've identified the issue / bug. I've imported an old project file with working fonts and tried to publish it. I...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@heitorvrb Ah, thanks for the extra info! If you’re deployed under a subdirectory, that should be reflected in your
setPublicPath
:You can see an example of this in the tests as well: https://github.com/symfony/webpack-encore/blob/db980b4018104b8f16a9f83111078ce86e7b76ad/test/functional.js#L180
Webpack must be aware of the true public path, because if you use “code splitting”, then webpack itself will make AJAX requests for assets (so it needs to know the real path). That’s why the config lives in
webpack.config.js
, instead of allowing your app (i.e. Symfony) to “fix” the subdirectory.Let me know if that helps! I’ll open an issue on the docs about this.
@kevinpapst @weaverryan
I am in this scenario:
I have deleted these two lines of code in version 0.17.2 (they add a traling slash if it is not present), so that I can have a public path defined as
''
(otherwise it is transformed to'/'
).With this configuration in webpack.config.js
all works correctly:
I can access assets from twig with
And if some scss file (like in Bootstrap) uses some other file (like glyphicons fonts) they are referenced properly. For example
glyphicons-halflings-regular.eot
is referenced asurl(fonts/glyphicons-halflings-regular.f4769f9b.eot)
in compiled css.I am wondering: is this solution acceptable or are there some other consequences/scenarios which I can’t figure out (I’m new to encore/webpack and nodejs…)?
If it is acceptable, we could test if
publicPath
is not empty before adding the trailing slash.