javascript - Twig assets unable to find js files -


i use symfony 2.7. have tried load javascript file via javascript block. twig throws following error message:

an exception has been thrown during compilation of template ("unable find file "@appbundle/resources/public/js/".") in "security/registration.html.twig".

so here registration.html.twig:

{% block body %}  //divs. {% endblock %}  {% block javascripts %}     {% javascripts '@appbundle/resources/public/js/*' %}         <script src="{{ asset_url }}"></script>     {% endjavascripts %} {% endblock %} 

i have checked folder path, , okay, in view: /var/www/html/userauthentication/app/resources/public/js/registration.js

and here index.twig.html include registration.twig.html:

{% extends '::base.html.twig' %}  {% block body %}     <div id="wrapper">         <div id="container">              {{ render(controller('appbundle:security:login')) }}              {{ render(controller('appbundle:security:register')) }}          </div>     </div> {% endblock %} 

and how base.twig.html looks:

<!doctype html> <html>     <head>         <meta charset="utf-8" />         <title>{% block title %}welcome!{% endblock %}</title>         {% block stylesheets %}{% endblock %}         <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">      </head>     <body>         <div class="container">             {% block body %}{% endblock %}         </div>         <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>         {% block javascripts %}{% endblock %}     </body> </html> 

and want registration.js within javascripts block

my config.yml:

assetic:     debug:          "%kernel.debug%"     use_controller: false     bundles:        [ 'appbundle' ] 

i have tried bundles in way: bundles: [], not change nothing in twig, twig template still throws same exception.

and not find, problem / , not understand. knows mistake?

and here bundle dependencies (composer.json):

"require": {         "php": ">=5.3.9",         "symfony/symfony": "2.7.*",         "doctrine/orm": "~2.2,>=2.2.3,<2.5",         "doctrine/dbal": "<2.5",         "doctrine/doctrine-bundle": "~1.4",         "symfony/assetic-bundle": "dev-master",         "symfony/swiftmailer-bundle": "~2.3",         "symfony/monolog-bundle": "~2.4",         "sensio/distribution-bundle": "~4.0",         "sensio/framework-extra-bundle": "~3.0,>=3.0.2",         "incenteev/composer-parameter-handler": "~2.0",         "ircmaxell/password-compat": "~1.0.3"     }, 

yes, have run app/console cache:clear, app/console assets:install , app/console assetic:dump commands many times. :(

@appbundle/resources/public/js/* points src/appbundle/resources/public/js/* not app/resources/public/js/*

to use app/resources should use: "%kernel.root_dir%/resources/assets/js/"

i'm starting using s2.8 , have similar problems (not resolved yet).


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -