2

config.yml

jquery:
         inputs:
              - %kernel.root_dir%/../vendor/components/jquery/jquery.min.js

composer.json

"require": {
    "components/jqueryui" : "dev-master",
    "components/jquery":  "dev-master"
},
//...

Jquery located in vendor\composer but symfony dont reconzie this path:

[message] The source file "F:\UniServerZ\www\app/../vendor/jquery/jquery/jquery.min.js" does not exist.

How i can link to components/ folder?....

6
  • I would suggest that you keep jQuery out of framework's vendors. Why do you need it there? It's a .js file, it's not namespaced, and should instead be imported through cdn. Commented Feb 23, 2015 at 19:31
  • I want have a always actual JQuery. Commented Feb 23, 2015 at 19:43
  • Are you sure your config.yml is tje same as posted here? Commented Feb 23, 2015 at 19:45
  • Sure, symfony just escape "components" folder... Commented Feb 23, 2015 at 19:48
  • @user3468055: well, you can, I just have to warn you that use of dev-master is bad practice, because if you're building large system, you have to be specific about your dependencies. What if you're system is 2 years old, and next jQuery release marks as deprecated or excludes some functions you've used in your code? And I'm sure your code does not work because it fails to autoload jQuery due to lack of namespace. Commented Feb 23, 2015 at 19:54

1 Answer 1

5

All right, I think thats because jQuery should be in public folder, web, so you than can access it from the outside.

composer.json:

"config": {
    "bin-dir": "bin",
    "component-dir": "web/components"
},

Than you can use it like (assetic):

{% javascripts 'components/jquery/jquery.min.js' %}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}

Hope it helps.

Sign up to request clarification or add additional context in comments.

1 Comment

I also had to do composer require robloach/component-installer to add this installer into the .json. This installer is the one that was able to interpret the component-dir configuration. Without this, composer installed the components in the root instead of the web directory. More info at github.com/RobLoach/component-installer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.