How to declarate js variable into global scope from twig template?
I have twig template with that:
<script type="text/javascript">
var initParams = {
homePage: '{{ url('_homepage') }}'
};
</script>
On other hand, i have .js file with usage of initParams.homePage. The problem is PHPStorm think that my initParams is not defined. Is there the way to send defination of inTwig js variables to global PHPStorm scope?
Thanks in advance!
请先登录再写评论。
see https://youtrack.jetbrains.com/issue/WI-3696 - each "injected" fragment is currently a separate virtual document, so variables declared in such fragments are only 'visible' inside them