Fonts and images from an assets-only gem


#1

Hi, I’m trying to use a set of in-house assets that are packaged as a gem and running into some trouble.

The gem includes a single ruby file for the asset path bit, and neat, since it strangely isn’t available despite being a runtime-required gem in the gemspec.

# frozen_string_literal: true

require 'neat'
require 'hanami/assets'

Hanami::Assets.sources << File.expand_path(File.join(__dir__, '..', 'vendor/assets'))

vendor/assets has the common collection of sub-directories: fonts, images, javascripts, stylesheets.

The SCSS and JS all works, but we can’t get the images or fonts to show up. It seems similar to this post but we don’t have the option of just putting everything in public. It’s a shared library and this application is just one consumer.

None of /vendor/assets/fonts/somefont.ttf, /assets/fonts/somefont.ttf, or /fonts/somefont.ttf work. (The last one is what I think we’re supposed to expect would work?)

Same story for images.

So what are we doing wrong?


#2

@TrevorBramble Hi and sorry for the late reply, it looks like I wasn’t receiving notifications anymore from the forum.

I think this is somehow related to: https://github.com/hanami/assets/issues/79