pixelhandler

Pushin' & pullin' pixels on the net

Apache Directive to Combine .js and .css Files

I like to keep CSS files named separately like ; reset.css, elements.css, classes.css, layout.css and so on. Also, I like to keep jQuery plugins in individual files. This apache directive allows me to combine .js and .css files into a single file. This is a great performance advantage, less http requests on page load; see Google’s best practices for tips on combining external css and js.
# Allows concatenation from files ending with .js and .css  
# In styles.combined.css use...
#   <!--#include file="reset.css" -->
#   <!--#include file="layout.css" -->
# these will included into this single file

<FilesMatch ".combined.js">
        Options +Includes
        SetOutputFilter INCLUDES
</FilesMatch>
<FilesMatch ".combined.css">
        Options +Includes
        SetOutputFilter INCLUDES
</FilesMatch>

Comments