Dimentica Dimentica - 1 year ago 302
Twig Question

Twig include CSS or Java Script

I am completely new to Twig. I have a Twig project, but I do not manage to configure paths to css and js file in the project.
The packages I have installed (as in the composer.json file) are:

"require": {
"twig/twig": "~1.0",
"symfony/twig-bundle": "^3.1",
"symfony/asset": "^3.1",
"symfony/templating": "^3.1",
"symfony/yaml": "^3.1"

In the project I have a folder "vendor" (where all these packages are found) and folder "web", in which I want to put my folders "views", "resources/images" and "resources/styles".

However, when I try to run in cmd the command:

php app/console assets:install web --symlink

I get the error: Could not open input file: app/console.

What should I do to include a css file, or image, or js file in the most accurate way?

Answer Source

In Symfony version 3.x it was changed from app/console to bin/console.

Additionally you should follow the 3.x installation guide for Symfony Installer or for composer installation to ensure you have the desired library and bundles. As the console and directory structure are not automatically created when using Composer alone.

Your composer should consist of pretty much only symfony/framework-standard-edition instead of the individual components. Otherwise you will need to install the components manually, and setup any other dependencies and configurations to get them all to work together. http://symfony.com/components

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download