Use the BAT sentence command to implement fast merge JS, Css_dos/bat

Source: Internet
Author: User

In the project development environment, we will be as modular as possible JS code, easy to manage and modify, this will not be able to avoid the occurrence of a project itself JS file number to 10 or more.

And the project on the line, will require all JS files merged into 1 or several, manual operation, although it is not a problem, but each update to modify the manual operation of the merger, this is certainly a nightmare.

In this case, some tools are also generated, such as online mergers, some sites to provide JS file upload, and then merge, but this is still very troublesome, if the development environment without network?

This will I think of the Windows system in the cmd Copy command, although it is a copy of the function, but in fact is also able to implement the requirements of the merged file, the following look at this code:

Copy Code code as follows:

Copy a.js+b.js+c.js abc.js/b

Believe that not too much programming people read the above code can also be roughly read the meaning: through the copy command will a.js B.js C.js merged into a abc.js, the last B/s means the file as a binary file, the copy command of other parameters can be in cmd input copy/? Study, here is no longer detailed.

Speaking of which, in fact, Windows itself can complete our needs, and do not install any other tools, the next thing we want to do is to make all of this easier.

We in the Project store JS folder under a new TXT file, copy the code in, and modify the need to merge which files, and finally save and TXT modified to a BAT suffix, such as:

Copy Code code as follows:

Copy core.js+hros.app.js+hros.appmanage.js+hros.base.js+hros.copyright.js+hros.desktop.js+hros.dock.js+ hros.folderview.js+hros.grid.js+hros.maskbox.js+hros.navbar.js+hros.popupmenu.js+hros.searchbar.js+ hros.startmenu.js+hros.taskbar.js+hros.uploadfile.js+hros.wallpaper.js+hros.widget.js+hros.window.js+ Hros.zoom.js+templates.js+util.js core.min.js/b

Next we double click on the BAT file, see the effect of it? That's what we want. Every time before the line, just double-click the file, the system will automatically merge and generate a merged file, compared to what other tools, this efficiency is simply unable to look directly.

If you have installed UGLIFYJS this tool locally, you can add a compressed code to the following code, such as:

Copy Code code as follows:

Copy core.js+hros.app.js+hros.appmanage.js+hros.base.js+hros.copyright.js+hros.desktop.js+hros.dock.js+ hros.folderview.js+hros.grid.js+hros.maskbox.js+hros.navbar.js+hros.popupmenu.js+hros.searchbar.js+ hros.startmenu.js+hros.taskbar.js+hros.uploadfile.js+hros.wallpaper.js+hros.widget.js+hros.window.js+ Hros.zoom.js+templates.js+util.js core.min.js/b
Uglifyjs core.min.js-m-O core.min.js

In this way, each time the combination of the automatic compression, and save one step of operation.

CSS merges in the same vein.

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.