Rukmi Patel Rukmi Patel - 6 months ago 33
Node.js Question

Integrate Angular JS 1 with Laravel 5.2

I am trying to install Angular JS 1 with laravel 5.2. I have installed dependencies using npm. It had created node_modules folder parallel to app folder.

My first question is - is it advisable to have node_modules parallel to app directory?

My second question is - if no way but to keep node_modules parallel to app folder, how to include js/css files of node_modules in view files?

Please provide your views on it as I am new to both technologies.

Answer

Most likely you would only need the node_modules folder in build time, so it does not really matter where it is. Just copy the required files in the desired application folder, preferable using a Grunt task, or a similar solution. When deploying your application, you can just simply ignore the folder.

I suggest taking a look at grunt-contrib-copy, as it provides a Grunt task for this operation. Another possibility is the copyfiles package.

Comments