Front-end file sharing under the Nodejs platform

Source: Internet
Author: User

First, front-end file sharing needs background-why should I share?
    1. Project Basic Js/nodejs full-end development, some of the 代码 front and rear end need to be used
    2. 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
    1. Browserify
    2. Static Resource Directory
    3. How to Build
    4. 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
      1. 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;

      2. Front and end references
        The front end uses SCRIPT-SRC references;
        The backend uses require references;

      3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.