Zepto.js custom packaging module process

mobile end Many people use traffic, and 4g is fast, but there are many times when the signal is not very good, in order to submit the loading speed, give the user a better experience, so The requirements for mobile code are much higher than pc. Try not to use large libraries and frameworks, so there is Zepto. It is officially a lightweight JavaScript library for advanced browsers, similar to jQuery. Api, to put it plainly, is the jQuery used on mobile phones, but jQuery is too big, and there is no support for the mobile side, so there is Zepto.

Download zepto source code at https://github.com/madrobby/zepto;

zepto.js <wbr>自定义打包模块流程

can see that Zepto has a lot of function modules, but there is no check. Checking is only some basic usage, you can refer to the official Documentation, let's talk about how to package these modules together:

1. First confirm whether the node.js and npm package management tools are installed in your computer; you can view node -v and npm -v in the terminal output; If you install Baidu on your own;

2. Download the zip package from github: https://github.com/madrobby/zepto, download it to the local open:

, you can find a file named make in this directory. File, find this file, open it with your familiar editor:

zepto.js <wbr>自定义打包模块流程

at line 41, write the module that needs to be packaged after IE, divide it by space, write it and save it.

3.win+R Enter cmd to enter the command window and enter the cd directory of this file (with spaces in between).

or select the folder and hold down the shift key and right click to select the "Open command window here" shortcut to open;

example:

zepto.js <wbr>自定义打包模块流程 可以输入cd+空格后把文件夹拖进来按回车就会进入此文件夹,窗户会有提示,若此文件夹不在c盘的话,可能会进不去此文件夹,解决办法,在上一步按完回车没进去的基础上,在输入D: (在按回车就行了),D是你的文件夹所在的盘;

4. Enter in the black window:

npm install  

npm run-script dist 

The step can be completed. Now go to the root directory of this folder to find the dist folder, you want the big package to pass the module with Zepto just fine.