global_asset_url

Returns the url of a ‘global asset’. Global assets are commonly used assets. By using these url’s as input for a script_tag or stylesheet_tag you don’t have to upload them yourself. Usually the url’s are of the recommended CDN’s.

The filter accepts two possible arguments: asset type (css/js) and version (default value depending on asset).

Input:

{{ "bootstrap" | global_asset_url | stylesheet_tag }} {{ "bootstrap" | global_asset_url: "js", "4.0.0-beta" | script_tag }}

Output:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>

The following global assets are available:

"bootstrap" # Default version: 3.3.7. Available types: css, js. "font_awesome" # Default version: 4.7.0. Available types: css.

global_asset_url for FontAwesome only works for version 4.7.0 and lower.