Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: randomize files name #125

Open
Malin88 opened this issue Jan 22, 2018 · 5 comments
Open

feat: randomize files name #125

Malin88 opened this issue Jan 22, 2018 · 5 comments
Assignees

Comments

@Malin88
Copy link

Malin88 commented Jan 22, 2018

How can I randomize font files name? I have some problem with browser cache so I want to generate file like webfont.scss with src: url("[some-random-string]") How can I do that ?

@alexander-akait
Copy link
Member

@Malin88 you can use custom template also we can add option to pass custom variables into template, PR welcome

@alexander-akait
Copy link
Member

use option fontName:

{ 
   fontName: webfont-${Math.random().toString(36).substring(7)} 
}

@Malin88
Copy link
Author

Malin88 commented Mar 26, 2018

thx, but this option did not do what I expected. After I used it got font files like webfont-asd34cxf.eot and also scss files with the same name webfont-asd34cxf.scss so after any font regeneration, I need to update file name of included font :/

@jwhitley
Copy link

Don't use Math.random(). This exact problem is widely solved by including a hash of the contents in the filename. Even an old algorithm like MD5 is fine for this purpose, since there's no security impact. That is a far better solution, since only changes that affect the webfont data will cause a filename update.

@jimmyandrade
Copy link
Collaborator

How can I randomize font files name? I have some problem with browser cache so I want to generate file like webfont.scss with src: url("[some-random-string]") How can I do that ?

@Malin88 do you believe that adding a cache querystring and/or version querystring would meet your need?

@jimmyandrade jimmyandrade changed the title Randomize files name feat: randomize files name Sep 29, 2020
@jimmyandrade jimmyandrade added this to To do in webfont project via automation Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

4 participants