A command to quickly merge JS, CSS

Source: Internet
Author: User
Tags cmd copy

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

And the project on-line, will be required to combine all JS files into 1 or several, manual operation although not a problem, but each change update to manual operation to merge again, this must be a nightmare.

In this case, some tools are also generated, such as online consolidation, some sites provide JS file upload, and then merge, but this is still very troublesome, if the development environment does not have a network?

This will I think of the Windows system cmd in the Copy command, although it is a copy of the function, but it is also possible to implement the need to merge files, the following look at this code:

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

Believe that not too many programmers read the above code can also read the meaning of the above: the copy command to merge the A.js B.js c.js into a abc.js, and the last/b to indicate that the file is a binary file, the other parameters of the copy command can be entered in the cmd copy/? Study, there is no longer a detailed statement.

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

We create a TXT file under the project's JS folder, copy the code into it, modify which files need to be merged, and finally save and change txt to the BAT suffix, such as:

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 the BAT file to see the effect? That's what we want. The next time you go online, just double-click on the file, the system will automatically merge and generate a merged file, compared to what other tools, this efficiency can hardly look directly.

If you have installed the Uglifyjs tool locally, you can add a compressed code behind the code, such as:

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 /buglifyjs core.min.js -m -o core.min.js

This automatically compresses each time it is merged and saves one step.

CSS merging is similarly.

Hu Yuan, original link: http://www.cnblogs.com/hooray/p/3292958.html

A command to quickly merge JS, CSS

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.