question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack generates wrong paths for fonts in css

See original GitHub issue

Referencing a font-face for a local file produces wrong paths when using run build.

Example structure:

/src
  /assets
    /fonts
      fonts.css
      font.ttf

In fonts.css i reference the font as url(./font.ttf) since they’re in the same directory. After run build it produces the following css in static/css.

url(./static/media/font.ttf)

build folder structure

/static
  /css
    main.css
  /media
    font.ttf

So the css is looking for the font file in css/static/media/font.tff, when it should really be ../media/font.ttf

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
gaearoncommented, Sep 23, 2016

After run build it produces the following css in static/css.

I can’t reproduce this with default settings.

Do you have a homepage field in package.json? If yes, what is it set to?

1reaction
iRoachiecommented, Sep 23, 2016

./

Read more comments on GitHub >

github_iconTop Results From Across the Web

Font urls path is wrong and includes css path after WebPack ...
I'm having MiniCssExtractPlugin create css or less files encountered. I am importing a less and a css file in src/client/index.tsx: import './ ...
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 >
MiniCssExtractPlugin - webpack
This plugin extracts CSS into separate files. It creates a CSS file per JS file which contains CSS. It supports On-Demand-Loading of CSS...
Read more >
Loading Fonts with webpack - Chris Courses
If webpack finds any font files being referenced inside of any CSS files being pulled into app.js , it'll duplicate the font files,...
Read more >
@daipeng7/iconfont-webpack-plugin - npm
Default value: [path of cssOutput] + /font-preview.html . Or false value. Destination for generated html-preview file (file name). If false , no ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found