Reference error Sfjs is not defined
Asked Answered
O

3

5

I just started with symfony, on template I simply define:

{% javascripts "@MyBundle/Resources/public/js/app.js" %}
    <script src="{{asset_url}}"></script>
{% endjavascripts %}

right before closing body tag </body>.

I get this javascript error:

ReferenceError: Sfjs is not defined

It seems like my javascript is affecting symfony debugbar script. but its happen even when my app.js contains nothing. How should I fix this ? thanks.

Oblate answered 27/4, 2015 at 5:19 Comment(0)
G
27

Although this is an old topic with an already found untold solution, I just wanted to share my experience that when I was confronted with the same error, it was due to the fact that I had forgotten to add a closing </script> tag somewhere in my base template.

Genna answered 30/5, 2016 at 14:0 Comment(0)
S
0

I'm relatively new to Symfony myself, but I believe you need to put spaces between the brackets and the variable. In other words, the second line should look like this:

<script src="{{ asset_url }}"></script>

That should help Symfony find the script, which will allow the toolbar to show up.

Hope that helps!

Stealing answered 20/5, 2015 at 3:47 Comment(0)
C
0

In my case, I have added a style sheet that interfered with JS. Not sure how or why TBH.

<style rel="stylesheet" href="/assets/plugins/icheck-bootstrap/icheck-bootstrap.min.css"/>
Cheyney answered 19/6, 2023 at 6:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.