how to create custom page and javascript in shopify code example
Example: custom js shopify
If I understand correctly, the asset_url filter is what you are looking for.
To include a JS file in a .liquid file, you use:
{{ 'script.js' | asset_url | script_tag }}
And a CSS file:
{{ 'style.css' | asset_url | stylesheet_tag }}