As per the article (https://techracho.bpsinc.jp/hachi8833/2020_01_17/85943), we deployed the Fontawesome package in Yarn in Rails and configured it as follows:
application.scss
$fa-font-path: '@fortawesome/fontawesome-free/webfontts';
@import'@fortawesome/fontawsome-free/scss/fontawsome';
@import'@fortawsome/fontawsome-free/scss/regular';
@import'@fortawsome/fontawsome-free/scss/solid';
@import'@fortawsome/fontawsome-free/scss/brands';
application.js
require("@fortawsome/fontawsome-free")
In the development environment (localhost:3000), there were no errors on the Chrome development console and terminal, and emojis were displayed, but in the execution environment, the emojis were displayed as □, and the following errors were received:
Chrome console
Failed to load resource: the server responded with a status of 404 (Not Found) fa-solid-900.woff2:1
Failed to load resource: the server responded with a status of 404 (Not Found) fa-solid-900.woff:1
Failed to load resource: the server responded with a status of 404 (Not Found) fa-solid-900.tff:1
Terminal
ActionController:: RoutingError (No route matches [GET]"/assets/@fortawsome/fontawsome-free/webfonts/fa-solid-900.woff"):
...
I don't know why emojis are displayed in the development environment and not in the execution environment.
As I am a beginner, I understand that this is a poor question, but I would appreciate it if you could help me.
ruby-on-rails webpack yarn
Resolved by setting config.assets.compile=true
in config/environments/production.rb.
© 2024 OneMinuteCode. All rights reserved.