CSS file and JS file organization

Source: Internet
Author: User

Multiple CSS files and JS files are used during development. How to organize them becomes a problem.

I personally think that multiple files are used during development, so that you can easily view them and merge them into one at the time of release.

The general idea is as follows: two files are generally used during development, one is used during release, and the other is loaded by the program according to the configuration.
For example, if a all-debug.css file is used during development, the content in the file is:
@ Import URL (../960/960 -all.css );
@ Import url(core.css );
@ Import url(two_col_form.css );
There is also an all-release.css file, which will be used during the release, and the tool will be used to merge the above CSS files into one.
Load one of the two files according to the configuration in the code.

 

This can also be used for JS management. In the debug file, write a JS Loading Method and load the JS file in sequence. When the file is released, it is directly merged and no longer loaded with Js.

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.