FROM CACHE - en_header

Shopify app - how to include assets using an app-proxy with ruby on rails

Shopify Partner
2 0 0

I'm building a shopify app-proxy using ruby on rails. i’m using the shopify_app gem.

in my controller actions i have the following set:

render layout: false, content_type: ‘application/liquid'

- so that the app is embedded within the shop’s layout/theme.liquid.

my question is how do i then pull assets into the app? I’ve tried including them manually into the template files using: 

<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>

but alas, i get 404 not found errors. currently i’m putting asset files into the store’s theme which doesn’t seem ideal.

Replies 3 (3)
6 0 8

Hey did you manage to figure this out? Could it have something to do with the way Rails fingerprints the assets?

EDIT (SOLVED): I was recieving 404s because the asset host domain was getting changed to the shopify store's domain. In order for Rails to find your assets you need to specify the domain in your production enviroment (production.rb):

config.action_controller.asset_host = ""

Hope this helps! 

Shopify Partner
2 0 0

Thanks, Matias!  This was driving me nuts.  

Shopify Partner
232 2 45