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.

Disable hashed file names for font files

See original GitHub issue

Here’s an example, I’m loading some fonts:

@font-face {
    font-family: "Flaticon";
    src: url("./font/Flaticon.eot");
    src: url("./font/Flaticon.eot?#iefix") format("embedded-opentype"),
    url("./font/Flaticon.woff") format("woff"),
    url("./font/Flaticon.ttf") format("truetype"),
    url("./font/Flaticon.svg#Flaticon") format("svg");
    font-weight: normal;
    font-style: normal;
}

The font files will never ever change.

And yet, for every build:

image

A new hashed file name is generated, meaning after every deploy, my users have to download the fonts over and over, just because the name changed.

I’d like to keep the hashed file names for CSS/JS and all, but why are font file names hashed by default? And what’s the solution to this? I want no name hashing for font file.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

3reactions
miraagecommented, Aug 9, 2020

Bot not now

2reactions
miraagecommented, Jul 10, 2020

I can see 'static/media/[name].[hash:8].[ext]' for the file-loader. Maybe [contenthash] would make more sense.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack 5: file-loader generates a copy of fonts with hash ...
In this case, we want to use our own file-loader and disable the Asset Module . We can set the type to 'javascript/auto'....
Read more >
Adding Hashes to Filenames - SurviveJS
The files have neat hashes now. To prove that it works for styling, you could try altering src/main.css and see what happens to...
Read more >
Loading Fonts with webpack - Chris Courses
I tried to copy fonts in ./font folder BUT afer bundling there was font files with long "hash" names (like 13513397853535314.ttf) in ./dist ......
Read more >
Stop vite from adding hash/hex to specific css stylesheet on ...
My whole ViteJS config is below. Does anyone know how to compile without adding the hash/hex in the filename? Current output filename on...
Read more >
How to use @font-face in CSS
It's true, @font-face can load a font file full of icons that can be used ... up the font files family name, fontname...
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