First, front-end file sharing needs background-why should I share?
- Project Basic Js/nodejs full-end development, some of the
代码
front and rear end need to be used
- There
配置
are some that need to be used at the front and back.
Distinguish the other development platform, the front-end file sharing under the Nodejs platform, can be the file without modification of the front and back of the interoperability.
You need 规范
a set of files to manage and organize the front-end sharing.
Ii. Optional Options
- Browserify
- Static Resource Directory
- How to Build
- Server-side IO processing
Programme |
Advantages |
Disadvantages |
Browserify |
Server-side Support good |
Packaged for AMD standard, front desk needs to rely on Requirejs |
Static Resource Directory |
Easy Organizational Approach |
1, the front-end can not be compressed, merged 2, if the public files in the root directory, the code is out of the front and back-end engineering directory, the code is broken organization |
Build |
can solve compression problems |
Must be processed by the build command when publishing |
Server-side IO processing |
File Directory organization flexibility |
The front end cannot be compressed, merged |
Third, plan to adopt the scheme--the way to build Fullstack_modules directory
Catalog Definition
Build a shared directory fullstack_modules
;
And the Webserver container is set to a static directory;
The front and back end are called directly;
Front and end references
The front end uses SCRIPT-SRC references;
The backend uses require references;
Front-End Build
The file will be created when a new file is generated by compressing and merging through Grunt COPY到其他目录
;
Front-end file sharing under the Nodejs platform