Gulp Packing Compression JS code

Source: Internet
Author: User

This is a small demo that implements the following functions:

1. In the JS code to pack a lot of JS files, we need to control some individual JS pieces must be in front. Here is a simple implementation.

2. The implementation is merged into a JS file.

3. The implementation is compressed into one line, that is, generate *.min.js.

First, look at the directory structure

Wherein Main.js simulates the most important one JS file, on the page should first need to load the JS. File.

We put the files that do not need to consider the order in the JS folder. Main.js A.js b.js inside a few simple code. You can download the demo file to view.

Gulpfile.js

The Package.json file contains the plugin that the demo relies on.

Perform gulp tasks

Successful execution, below shows us the generated app.min.js file.

Demo file Baidu: Http://pan.baidu.com/s/1hswqNgo

Gulp Packing Compression JS code

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.