Laravel & Angular
This setup involves creating a Laravel API and an Angular client-app with Gulp covering the asset pipeline.
Our Laravel API server will serve one view only and that is to simply load the Angular app.
First, create a new directory for your project. We're going to place the
client directories in here. You'll need to install Laravel, Yeoman, generator-gulp-angular and any other dependencies.
mkdir exampleApp && $_ laravel new server
exampleApp/server/app/routes.php and change
return View::make('hello'); to
For the client, run Yeoman to setup the app. We'll replace the build task to suit Laravel's setup.
mkdir client && $_ yo gulp-angular client
Before running any Gulp tasks, let's replace gulp-ruby-sass with gulp-sass. Gulp-sass is faster. We'll also need
npm install gulp-sass gulp-rename gulp-notify --save-dev
After you've run the generator and selected your preferred modules etc., replace
exampleApp/client/gulp/build.js with the file provided below. The
gulp build task will output all assets into
exampleApp/server/public/ and output the html file as
exampleApp/server/app/views/index.blade.php all setup to load your Angular app.
gulp buildto build an optimized version of your application in /server/public. The index file is placed in /server/app/views/ as index.blade.html
gulp serveto launch a browser sync server on your source files
gulp serve:distto launch a server on your optimized application
gulp wiredepto fill bower dependencies in your .html file(s)
gulp testto launch your unit tests with Karma
gulp protractorto launch your e2e tests with Protractor
gulp protractor:distto launch your e2e tests with Protractor on the dist files