secra/caching-proxy
Composer 安装命令:
composer require secra/caching-proxy
包简介
Converts a bunch of .css/.js files to one minified file and precompress them with gzip. Rewrite all relative path of ressources in css files.
关键字:
README 文档
README
Caching Proxy Class
The CachingProxy include css and js files in other php scripts and build a path to the files, with an timestamp of the last modification in it.
Main features are
- detect last version of .css and .js Source files
- detect .min version of .css and .js files
- combine all .css and .js files to one cached file
- auto create gzip version of cached file
- depend on mod rewrite and browser, deliver precompressed files
- debugmode for development and native, unmodified inclusion of files
Usage
For .css files use the following code in the head of your webpage. The usage for .js should be obvious.
// set the path to you webserver document root most of the time $_SERVER["DOCUMENT_ROOT"]
// and in 2. parameter the path, were you would like to store your cached files absolut from document root
$css_cache = new \secra\CachingProxy\CssCachingProxy($_SERVER["DOCUMENT_ROOT"], "/path/to/css/cache");
// Add some files
$css_cache->addFile("/path/to/file1.css");
$css_cache->addFile("/path/to/file2.css");
// Do the packing work and print the html into the head
echo $css_cache->getIncludeHtml();
Demo page
The /demo folder contain a sample webpage with the CSS and Javascript.
Changelog
###Version 1.0 (04. Jan 2021)
- Upgrade PHP Version
- Switch to docker for local demo
###Version 0.2 (18. July 2014)
- Rewrite relative path of ressources in css files
###Version 0.1 (16. February 2014)
- Add Composer Support
- PSR-4 compatible
- EditorConfig Support
- Add Licence Text
- Add usage example in readme
Developer notes
See Developer_Info.md under folder vagarnt-vm
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-06-19