I started using the Mean JS boilerplate (ref website) and would like to know where the recommended place to include public custom javascript, jQuery files (ex. FacebookSDK, jQuery animations,...) .
I'm assuming it's going to be somewhere in the public folder. The default structure is as follows :
Should it go in modules or lib folder? Can you give more guidelines on what the function of each folder is? Any guidelines?
This is a great article on Angular app folder structure: https://scotch.io/tutorials/angularjs-best-practices-directory-structure
To answer your question about stuff like jQuery / bootstrap.js I would put them into a libs folder.
I use this methodology in all my apps now. For your Angular files the old way / way for small apps would probably have been this:
app/
----- controllers/
---------- mainController.js
---------- otherController.js
----- directives/
---------- mainDirective.js
---------- otherDirective.js
----- services/
---------- userService.js
---------- itemService.js
----- js/
---------- bootstrap.js
---------- jquery.js
----- app.js
views/
----- mainView.html
----- otherView.html
----- index.html
Better more efficient way (more descriptive as well):
app/
----- shared/ // acts as reusable components or partials of our site
---------- sidebar/
--------------- sidebarDirective.js
--------------- sidebarView.html
---------- article/
--------------- articleDirective.js
--------------- articleView.html
----- components/ // each component is treated as a mini Angular app
---------- home/
--------------- homeController.js
--------------- homeService.js
--------------- homeView.html
---------- blog/
--------------- blogController.js
--------------- blogService.js
--------------- blogView.html
----- app.module.js
----- app.routes.js
assets/
----- img/ // Images and icons for your app
----- css/ // All styles and style related files (SCSS or LESS files)
----- js/ // JavaScript files written for your app that are not for angular
----- libs/ // Third-party libraries such as jQuery, Moment, Underscore, etc.
index.html
What I'm using in my current project:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With