This article was published on 11 Oct 2016, this means the content may be
out of date or no longer relevant. You should verify that the technical information in this article is still current before relying upon it for your own purposes.
So, we want to create an application and use Symfony as backend and Angular 1.x as frontend. Here come some questions:
Where to put angular files (folder/structure)?
Ho to automate frontend workflow?
In this article we use a standard Symfony project folder structure:
To glue Symfony with Angular we will use Gulp. Next step we need to install it:
and then some gulp additional modules:
After everything will be installed we add a new gulpfile.js in the root of our project:
Our Angular app script will be placed in the AppBundle in src/AppBundle/Resources/public/js/app.js file:
And that is all! Now our application skeleton is ready. Everything related to frontend should be placed in src/AppBundle/Resources/public/js/ folder. After running gulp all project js and css files will be put in the web folder, in the web/js/app.js and web/css/style.css files accordingly.
The last step is to include them in the main application layout app/Resources/views/base.html.twig:
@ 2021. All rights reserved.
If you've got any feedback, comments or just want to chat you can get in
touch via Twitter or email.