Usage of front-end build tools-grunt, Gulp, Browserify, Webpack

Source: Internet
Author: User
Tags install node

With the rapid development of front-end projects, more and more projects, more and more documents, front-end engineering tools are more and more. Here are four of the most popular build tools--grunt, Gulp, Browserify, Webpack

All build tools are based on Nodejs and NPM, so you need to install node using any of the following tools

First, Grunt

1. Two files required:

Gruntfile.js--grunt Execution Task File: Describes the tasks that the project will perform.

package.json--Project Description: Describes the project's basic information, and the NPM package information used in the project, to make it easier for others to understand the project information and run the project.

2. Install the GRUNT-CLI command environment and the grunt package used in the project

NPM Install Grunt-cli-g

Sudo:sudo NPM install grunt-cli-g required under Mac

NPM Install grunt--save-dev//--save-dev: Indicates that the NPM package needs to be used in the dev development environment, plus this automatically adds the relevant package description to the Package.json.

3. Install Grunt task related NPM package

NPM Install XXX--save-dev

4. Gruntfile.js Task

Module.exports =function(grunt) {//load the required task packagesGrunt.loadnpmtasks (' grunt-contrib-less '); Grunt.loadnpmtasks (' Grunt-contrib-uglify '); //Initializing TasksGrunt.initconfig ({"Less": {//Package Name"A": {//Task Name"src": "a.less",                "Dest": "Index.css"            },            "B":{                "src": "b.less",                "Dest": "Main.css"            }        },        "Uglify": {            A: {                "src": "Aa.js",                "Dest": "Index.js"            }        }    });

Register multi-tasking
Grunt.registertask (' abc ', [' less:a ', ' uglify ']);

}

Summary: One of the first tools to automate the building of front-end projects greatly improves development efficiency in the front-end development process, facilitates engineering deployment to the line, and optimizes online front-end code.

Second, gulp

Third, browserify

Iv. Webpack

Usage of front-end build tools-grunt, Gulp, Browserify, Webpack

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.