This project is archived and the repository is no longer maintained.
quickconcat
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 GPLv3concat.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.
Example CSS url:
quickconcat.php?files=css/a.css,css/b.css,css/c.css
Example JS url:
quickconcat.php?files=js/a.js,js/b.js,js/c.js
Example HTML url:
quickconcat.php?files=a.html,b.html,c.html
Example HTML url with wrapped entries:
quickconcat.php?files=a.html,b.html,c.html&wrap
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
</IfModule>
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
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。