a simple dynamic concatenator for html, css, and js files, written in php
Latest commit 01529d0 Apr 7, 2015 @johnbender johnbender Update README.md
Failed to load latest commit information.
test This will allow the test for regex to make sure it covers white space as Oct 30, 2012
.gitignore Adding a gitignore file for vendor and composer folders that pop up Oct 30, 2012
.repo-rt Create .repo-rt Apr 7, 2015
.travis.yml fixed newline handling for github4windows Oct 26, 2012
AUTHORS.txt Update to GPLv3 Jun 28, 2012
GPL-LICENSE.txt Update to GPLv3 Jun 28, 2012
README.md Update README.md Apr 7, 2015
composer.json fixed newline handling for github4windows Oct 26, 2012
quickconcat.php Cleaning this return up Nov 21, 2012



NOTE This repository has been retired and exists only as a reference.

a simple dynamic concatenator for html, css, and js files, written in PHP

  • Copyright 2012, Scott Jehl, Filament Group, Inc.
  • Dual licensed under MIT and GPLv3

concat.php accepts 2 query strings:

    * files (required): a comma-separated list of root-relative file paths
    * wrap (optional): Enclose each result in an element node with url attribute? False by default.

Build Status

Example CSS url:


Example JS url:


Example HTML url:


Example HTML url with wrapped entries:


Note that when wrap is passed, like above, each file will be wrapped in a entry element with a url attribute corresponding to the URL from which the content was included. For example:

<entry url="a.html">...content from file a here...</entry><entry url="b.html">...content from file b here...</entry><entry url="c.html">...content from file c here...</entry>

optional .htaccess ideas

To clean up your file paths, gzip output, and more, you might consider incorporating some server rewrites via Apache .htaccess or otherwise. Here's an example that allows for cleaner urls and zipped output:

# Cleaner URLs for quickconcat.php
# this allows for urls like this: "/path/to/file.html,path/to/fileb.html=concat"
# or wrapped, "/path/to/file.html,path/to/fileb.html=concat&wrap"
RewriteEngine On
RewriteRule ^([^\?]+)=concat(&wrap)?$ quickconcat.php?files=$1$2

# compress transfer
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css text/javascript

With the above dropped into your .htaccess file, you can concatenate files like this: /path/to/file.html,path/to/fileb.html=concat or like this (if you want to add wrappers) /path/to/file.html,path/to/fileb.html=concat&wrap