Попробуйте добавить это к application.rb
Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf|woff2)$/
и обновление
Rails.application.configure do
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*', :headers => :any, :methods => :any
end
end
end
с
Rails.application.configure do
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*', :headers => :any, :methods => :any
end
end
allow do
origins "*"
resource "/assets/*", methods: :get, headers: :any
end
end
и вы можете просто использовать
<%= preload_link_tag("Inter-UI.var.woff2") %>
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 400;
font-display: swap;
unicode-range: U+000-5FF;
src: font_url("Inter-UI.var.woff2") format("woff2-variations"),
font_url("Inter-UI-Italic.woff2") format("woff2"),
font_url("Inter-UI-Italic.woff") format("woff");
}
и если вы используете fonts.css.erb
внутри stylesheets
do
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 400;
font-display: swap;
unicode-range: U+000-5FF;
src: url(<%= asset_path "Inter-UI.var.woff2" %>) format("woff2-variations"),
url(<%= asset_path "Inter-UI-Italic.woff2" %>) format("woff2"),
url(<%= asset_path "Inter-UI-Italic.woff" %>) format("woff");
}
и до rake assets:precompile