Is there some way to reference sub-directories within the /assets directory of a theme?

Shopify Partner
17 0 0

Hi,

I am working on a theme and would like to be able to organize my /assets directory a bit by including some sub-directories within it.  That's easy enough but the trouble is calling them with Liquid and getting them from the CDN.  When I do something like this, everything works fine:

{{ 'modernizr.js' | asset_url | script_tag }}

But if I put modernizr.js in a sub-directory of /assets ..  for example /assets/js/modernizr.js and then do this, the file doesn't get found:

{{ 'js/modernizr.js' | asset_url | script_tag }}

I also tried this and it didn't work either:

{{ /js/'modernizr.js' | asset_url | script_tag }}

Is there someway to do what I'm talking about and I just have the syntax wrong or is it just something that currently can't be done in a theme with Liquid.

I hope it's just something I'm missing because I could use some organization and structure in my /assets directory!  :) 

Thanks in advance. 

 

 

0 Likes
Shopify Expert
685 0 68

Short answer: no : )

I'm a million different people
0 Likes
Shopify Partner
17 0 0

Doh!!!  Thanks for keeping it brief, Rick!  Although I would prefer a long answer that started with "Yes."  : )

0 Likes
Shopify Partner
53 0 8

Sorry, but shopify doesn't support (as yet) a asset folder hierarchy. Everything must go in the root.

0 Likes
Shopify Partner
17 0 0

Thanks Rob.  I sure would love to see that change at some point soon.  I'm very happy with Shopify either way but I would love to be able to break my /assets folder up into /img, /css, /js, etc. 

Shopify (if you see this):  I'm sure you have your reasons but please consider this!!  : )

0 Likes