I want to use AngularJS
with Laravel 5
. Since Laravel uses NPM to get gulp
and laravel-elixir
, my first step was to edit packages.json
:
{
"private": true,
"devDependencies": {
"gulp": "^3.8.8",
"laravel-elixir": "*",
"angular": "*" // import angular
}
}
After executing npm install
AngularJS is downloaded to the node_modules/angular
folder.
Now how do I use angular.js
in my HTML?
NOTE: My host settings are pointing to a public
folder.
EDIT:
For now I'm using this piece of code in my gulp.js
file:
elixir(function(mix) {
mix.copy('node_modules/angular/*.min.js', 'public/js/');
mix.copy('node_modules/angular-aria/*.min.js', 'public/js/');
mix.copy('node_modules/angular-animate/*.min.js', 'public/js/');
});
So I did, what I should've done before asking this question. Documentation.
As an example I will try to use LumX CSS framework bower package with Laravel 5.
Step 1. Install LumX and required packages.
Be sure you have Bower installed. Execute
bower install lumx
, this will createbower_components
folder within Laravel directory. You may want to add this directory to.gitignore
.Step 2. Prepare your project files.
Create
resources/assets/sass
folder andapp.scss
:Create
resources/assets/js
folder andapp.js
:Also be sure, that you have
public/js
,public/css
,public/fonts
folders and they are writable.Step 3. Use gulp.
Edit your
gulpfile.js
file:And execute
gulp
command.Step 4. Use CSS and JS files.
Insert this into
head
tag:Insert this before closing `body tag:
Specify
ng-app
attribute: