About deployed rails app fonts

Asked 1 years ago, Updated 1 years ago, 120 views

I deployed it with aws, but the font of the displayed app is different than before.

I was using a quail font, but when I deployed it and looked at the browser, it was a normal font and the font was not applied.

Browser (chrome) validation failed.

Failed to load resource: the server responded with a status of 404 (Not Found)

I checked the error and found that the file was not found.The problem seems to be the wrong path.

I was able to use it without any problems before the deployment, but I am confused.

This font is written in css.

@font-face{
    font-family: 'quizfont';
    src:url('nikumarufont.otf');
    font-weight:normal;
    font-style:normal;
}
@font-face{
    font-family: 'uzura';
    src:url('uzura.ttf');
    font-weight:normal;
    font-style:normal;
}

I only use the second quail with 2 pieces in it.

How can I apply fonts here?

Also, I have another question, do I need to command asset precompilation again when I change css?The commands are as follows

 bundle exec rake assemblies:precompile RAILS_ENV=production

Every time I change it, I restart this command and ec2 instance, restart nginx, and launch unicorn.

I don't know if it's relevant, but I couldn't deal with it because there were many asset precompile errors during deployment, so I introduced a Gem called yui-compressor and specified it in config.Then it worked so well that we are deploying it as it is.

DB is mysql and browser is chrome.The PC is a Mac.I would appreciate it if you could give me some advice.
Thank you for your cooperation

Additional information

Part of the path has been changed in css

 src:font-url('/assets/fonts/uzura.ttf');

This eliminates the verification error, but does not reflect the font itself.The number of riddles has increased again, but please continue to support me m(._.)m

ruby-on-rails ruby deployment

2022-09-30 21:33

1 Answers

Font was not applied.

Where are the font files located in the Rails app?
Rails basically handles static materials (CSS, JS, font files, images) with an mechanism called Assets Pipeline, but I would like to know if they are covered first.

Also, I have another question, do I need to command asset precompilation again when I change css?The commands are as follows

Yes, there is.
Rails' Assets Pipeline compiles all the materials and writes them out as separate files, so I think it's common to compile every deployment with or without any changes.

I don't know if it's relevant, but there are many asset precompilation errors during deployment.

What kind of error is it?There may be some misalignment of the file.

The verification error disappeared, but the font itself was not reflected.

With this specification, it is probably not suitable for the file that Assets Pipeline spit out.
Mystery is that the error disappeared, but it doesn't look like the correct putt designation.


2022-09-30 21:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.