Asset
The asset_*
functions map directly to the ``Anomaly\Streams\Platform\Asset\Asset` class. For more information on usage please refer to asset documentation.
{{ asset_add("theme.js", "theme::js/vendor/*") }}
{{ asset_add("theme.js", "theme::js/libraries/sortable.js", ["min"]) }}
{{ asset_script("theme.js", ["min"]) }}
{% for script in asset_scripts("scripts.js") %}
{{ script|raw }}
{% endfor %}
Including javascript constants
The constants
function returns a number of required javascript constants necessary for field types and potentially other components to work correctly. Make sure you include it in your themes!
{{ constants() }}
Example of the included JavaScript constants:
<script type="text/javascript">
var APPLICATION_URL = "{{ url() }}";
var APPLICATION_REFERENCE = "{{ env('APPLICATION_REFERENCE') }}";
var APPLICATION_DOMAIN = "{{ env('APPLICATION_DOMAIN') }}";
var CSRF_TOKEN = "{{ csrf_token() }}";
var APP_DEBUG = "{{ config_get('app.debug') }}";
var APP_URL = "{{ config_get('app.url') }}";
var REQUEST_ROOT = "{{ request_root() }}";
var REQUEST_ROOT_PATH = "{{ parse_url(request_root()).path }}";
var TIMEZONE = "{{ config_get('app.timezone') }}";
var LOCALE = "{{ config_get('app.locale') }}";
</script>