2

I kept getting a 404 on my application, only to realize that it is looking for a font: /assets/fonts/footable.woff

So I figured I'd just create the fonts folder within my app/assets folder, and then re-run RAILS_ENV=production rake assets:precompile

I did this, and when I do an ls to public/assets/, there is still no fonts folder.

Here's my config/application.rb

module MyRailsApp
  class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 5.1

    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.
    config.time_zone = "Central Time (US & Canada)"
    config.active_record.default_timezone = :local # Or :utc
    config.eager_load_paths += Dir["#{config.root}/lib/custom_rb/**/"]

    config.assets.enabled = true
    config.assets.paths << Rails.root.join("app", "assets", "images", "iCheck")
    config.assets.paths << Rails.root.join("app", "assets", "fonts")

    # For sidekiq
    #config.active_job.queue_adapter = :delayed_job
    config.active_job.queue_adapter = :sidekiq
  end
end

and here's my config/initializers/assets.rb file:

# Be sure to restart your server when you modify this file.

# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'

# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/

I have also restarted apache, and it's still not there.

What am I doing wrong?

LewlSauce
  • 5,326
  • 8
  • 44
  • 91
  • but did you add the fonts into /assets/fonts/ directory? – Nezir Oct 05 '18 at 06:51
  • 1
    Yep. Sure did. I just temporarily changed my theme and everywhere that looks for fonts/file to just simply look in the root folder. Not sure why this isn't working the other way. – LewlSauce Oct 05 '18 at 13:12
  • 1
    used few times, but really had all the time problems.. not sure what was solutions in my cases... but it can be horrible – Nezir Oct 05 '18 at 13:14
  • Have you tried this answer: [Using fonts with Rails asset pipeline](https://stackoverflow.com/questions/10905905/using-fonts-with-rails-asset-pipeline?rq=1) – R. Sierra Oct 05 '18 at 13:55
  • 1
    @R.Sierra Yeah. It doesn't seem possible to get the fonts directory to be a subdirectory of assets, no matter what I try. Even without adding any additional configurations for the asset pipeline, it seems to, by default, add fonts directly to the root of public. – LewlSauce Oct 05 '18 at 14:09

0 Answers0