Sell ​​assets, file structure and naming conventions

I use Shopify to develop my e-commerce site, and I'm a little confused about assets.

Am I just deleting all my JavaScript, css and images in the resource folder, or can I have auxiliary folders for each of them in the resource folder?

Does every file name need to end in .liquid?

If I can make subfolders, would I use a relative path like this?

{{ 'css/default.css' | asset_url | stylesheet_tag }} 
+5
source share
1 answer

You simply upload all assets (images, CSS, JS or any other file related to the theme of your site) to the resource folder. Then you just reference it by file name.

Subfolders are currently not possible, but I think many Shopify buyers will appreciate this. I personally like the clean folder structure.

CSS

 {{ 'styles.css' | asset_url | stylesheet_tag }} 

JS:

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

Link to images or other assets in CSS:

 {{ 'background.jpg' | asset_url }} div#myDIV { background: url({{ 'background.jpg' | asset_url }}) center center no-repeat; } 
+7
source

Source: https://habr.com/ru/post/1201698/


All Articles