Nithin
Nithin

Reputation: 1477

How to Include CSS and JS in Twig-View on Slim?

I am trying to include my CSS and JS files on my Twig template like this

{% block stylesheets %}
   <link href="{{ asset('bootstrap.min.css') }}" rel="stylesheet" />
{% endblock %}

{% block javascripts %}
   <script src="{{ asset('jquery-3.2.1.slim.min.js') }}"></script>
   <script src="{{ asset('popper.min.js') }}"></script>
   <script src="{{ asset('bootstrap.min.js') }}"></script>        
{% endblock %}

I get an error on Slim like this

Unknown "asset" function.

How do I include my CSS and JS files in Twig via Slim?

Upvotes: 1

Views: 1516

Answers (1)

Mike Doe
Mike Doe

Reputation: 17624

There’s no such function by default. Either install an Asset extension or hardcore links by yourself.

Upvotes: 4

Related Questions