MEANJS boilerplate : where to include custom javascript files?

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:
在这里输入图像描述

链接地址: http://www.djcxy.com/p/25620.html

上一篇: 如何使用lambda创建一个新的EventHandler?

下一篇: MEANJS样板文件:其中包含自定义JavaScript文件?