gulp introduction and manually install

gulp,
Front-end automation tools,
File operations,

Before on-line project that will merge fragmented files, the ES6 turn into ES5, file compression, to quickly build server ...

gulp-based node environment

gulp is a node of a non-built small modules

Operating principle gulp file: file stream

Front-end automation tools: gulp, webpack, grunt, browserify

use:
Non-built-in, it expresses, node default is no need to manually download
node modules, download environment using the node, node provides a way to download: npm tool
npm how to use the tool?
npm install download tool name
npm uninstall tool Uninstall name
npm init initialize the project environment, get profiles package.json
Profile: records information about the current projects, such as: name, version, and other tools. . . .

(Official download step ↓↓↓)
Download gulp:
1. Download Global: npm install gulp -g
Download a speed downloader
2. Download Local: npm install gulp --save-dev
2-1. Create a new folder, named (project name, such as plane, do not appear in Chinese path, not too deep, do not use the keyword gulp)
2-2. Open a command prompt and use the cd into the folder just the new plane
2-3 command to download a local gulp of: npm install gulp --save-dev
2-4 test whether the download was successful: gulp -v view the version number (two global and local)
2-5 Initialization Project: npm init -y
Note: there is a version of the tool, different versions of use may be different, you can choose
The latest version gulp is: 4.xx.xx, difficult to use, recommended 3.xx.xx
Change version:
1. Open the project generated after initialization file package.json
2. Locate gulp tool version number, will 4.xx.xx into 3.xx.xx, save
3. At the command prompt, type: npm install, Enter
2-6 Test gulp installation was successful: gulp -v, there are two version numbers, global and local (3.xx.xx)

2-7. Native gulp limited functionality, if you want more features, you need to install plug-ins gulp
Plug-in such as:
gulp-connect
http-proxy-middleware
gulp-concat
gulp-uglify
gulp-rename
Tip: Install command in the format: npm install tool name
2-8. After installation, see package.json, there will be a corresponding plug-in name and version number, the installation was successful


:( officially used to write code: Write where what is written how to perform)???
How to perform: Using gulp prefix command prompt execution
Where to write: within js file written in the gulpfile
gulp code: what to write

1. Definitions Function: gulpfile.js file by gulp.task () is defined
2. Use: In the command prompt: gulp custom command name
3. Check: according to the current command functions, authentication information corresponding to

gulp plug-ins:
Server Plug-in: gulp-connect
0. Download
1. The intake module
2. Define command
3. The method of execution plug-in
4. configuration information


Server proxy plug-in: http-proxy-middleware

Cross-domain:
Non-homologous
Front-end solution to cross-domain: jsonp
Way backstage to solve cross-domain: cors (setting allows request headers)
Proxy server to solve cross-domain:

Guess you like

Origin www.cnblogs.com/1179929172-zh/p/11479166.html