Gulp-webserver components

Source: Internet
Author: User

First, Gulp-webserver operating environment (winddows system-win8 X64)

1. Install the node. JS base Environment and download the link address.

2. Using NPM Integrated Gulp tool, command prompt wound paste input npm install-g--save-dev Gulp, Global Installation Gulp tool.

3.gulp tool installation After successful, integrated julp-webserver components, specific download integration method can refer to this description, at the Command Prompt window input: npm install--save-dev gulp-webserver, download the integration components.

4. In the Command Prompt window, enter the path of the project, execute the instructions: NPM link Gulp and NPM link gulp-webserver; Integrate the Gulp Toolkit and Gulp-webserver component packages into the root directory of the current project. The goal is to prevent errors when executing gulp instructions directly.

5. So far, the basic environment has been established.

Second, the configuration

1. First build the Gulpfile.js file in the project root directory

<span style= "White-space:pre" ></span>var Gulp = require (' gulp '); <span style= "White-space:pre" > </span>var webserver = require (' Gulp-webserver '); <span style= "White-space:pre" ></span>gulp.task ( ' Webserver ', function () {<span style= "White-space:pre" ></span>gulp.src (' G: '). Pipe (webserver ({//g): <span style= "White-space:pre" ></span>path: ' 2 ',//2 is the path where the project is located <span style= "White-space:pre" ></span>livereload:true,<span style= "White-space:pre" ></span>directoryListing:true,< Span style= "White-space:pre" ></span>open:true,<span style= "White-space:pre" ></span>fallback : ' index.html ' <span style= "White-space:pre" ></SPAN>}); <span style= "White-space:pre" ></span Gulp.task (' Default ', [' webserver ']);
2. Create a index.html file

3. Open a Command Prompt window, navigate to the path of the current project, execute the gulp instruction, if everything is OK, a gulp simple real-time refresh server is assembled.

4. The browser automatically opens the index page in the current directory, changes the content, and the page refreshes in real time.

Gulp-webserver components

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.