Shim configuration of modular development Requirejs

Source: Internet
Author: User

First, ShimRequirejs is developed using AMD specifications and is configured using Requirejs shim If the non-AMD specification JS is loaded during development.

The shim configuration syntax is:
//configuration fileRequirejs.config ({baseUrl:' JS ',//By default, the folder where Main.js is located is the benchmark. paths: {jquery:' Jquery-1.12.4.min '//from the individual name    },    //Key ConfigurationShim: {//Configuration Method One: Jquery.catenav is the module name, JQuery is a dependent JS module        //' Jquery.catenav ': [' jQuery ']                //configuration Mode Two: Jquery.catenav is the module name, Deps is a configuration-dependent JS module, Deps array, indicating the module's dependency' Jquery.catenav ': {deps: [' jquery '], exports:"Catenav"        }    }});//loading the ingress moduleRequirejs ([' Index ']);//start looking for index.js from the reference path JS

Ii. examples

Specific code examples refer to my GitHub address:Https://github.com/MengFangui/require-shim/tree/master


The sample code is a plug-in for the jquery-based anchor scrolling effect, the pluginit's me. Development based on jquery (without AMD specification), component address: http://www.cnblogs.com/mengfangui/p/7428500.html

The sample code enables the modular development of the non-AMD specification of JS loading.

Shim configuration of modular development Requirejs

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.