Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Fonts not found Rails (Production ENV)


In development the fonts load correctly from path:

lib/assets/plugins/global/fonts

however in production I get a 404 file not found for fonticon icons.

Note: bootstrap-icons load correctly in production and the paths match in plugins.bundle.css

Is there a place in the settings.yml where the font has to be loaded/listed?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


Hi

Do you mean you build the assets using the gulp --prod option?

Thanks



I am using Capistrano gem for Rails production environment. I got it figured out by moving the fonticon.css file to lib/assets/css and changing the file path in the css to and moving the fonts to custom/fonts/fonticon/{all fonts}.

Now icons bundle in asset pipeline as expected in production env.



Hi

Glad you have resolved it. Hope that your solution can help others as well.

Thanks



In the generated file, the fonts are referenced at url("fonts/something.ttf"). But rails does not know to look there, and thus, does not find them. So it converts the path to "/fonts/something.ttf", which 404s.

We had to explicitly let rails / sprockets know that it could look in that directory to find the font assets:

Rails.application.config.assets.paths < Rails.root.join("lib", "assets", "plugins", "global")

Note: this comment box will not allow me to use the correct syntax for inject. Be sure to use two less than characters


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(