CSS file merging

I need to combine CSS files into one large CSS file in order to reduce the connections made during page load. Basically, if I just add CSS files to one large file, will these styles work the same way as before, or is there a problem when combining multiple CSS files together? I am developing my software in Java, if there is some library that already combines CSS, I would like to hear about it.

+5
source share
3 answers

If your CSS files use @import, then combining them into one file can change the imported URLs.

If it @importhas a relative URL, it is resolved with respect to the URL containing the CSS, so you may inadvertently violate @imports.

http://www.w3.org/TR/css3-values/

To create modular style sheets that are independent of the absolute location of the resource, authors must use relative URIs. Relative URIs (as defined in [URIs]) are allowed for full URIs using the base URI. RFC 3986, section 3, defines the regulatory algorithm for this process. For CSS style sheets, the base URI is the style sheet, not the source document.

+1
source

Use ANT build script from HTML Boilerplate, whether you do the task perfectly.

+2
source

(: / ), @charset, . , @directives, .

+1

All Articles