sugiphp / assets
基于Assetic的SugiPHP资产管理组件
dev-master
2022-12-05 14:39 UTC
Requires
- php: >=5.3
- assetic/framework: ^3.0.1
- meenie/javascript-packer: ^1.1
- scssphp/scssphp: ^1.0
- wikimedia/less.php: ^3.1.0
- wikimedia/minify: ~2.2
This package is not auto-updated.
Last update: 2024-09-21 11:41:38 UTC
README
SugiPHP\Assets简化了PHP知名资产管理框架Assetic的使用Assetic。
CssPacker
CssPacker可以打包和压缩CSS样式表文件。它还可以处理LESS文件。
$config = array( "input_path" => "/path/to/your/assets", "output_path" => "/path/to/webroot/css", "debug" => true ); $css = new CssPacker($config); // add several files atones $css->add(array("reset.css", "common.css")); // add one file $css->add("pages/index.css"); // add a file not from the default input path: $css->add("/absolute/path/to/stylesheet.css"); // In your template file: <link rel="stylesheet" href="/css/<?php echo $css->pack(); ?>" /> // This will pack all assets in one and minify* them. Then the result // will be saved in a file. Return a filename. // *Minification will only be done if "debug" configuration option is // FALSE. This makes debugging easier. // If you want to get the contents only and not saving it in a file: <style type="text/css"> <?php echo $css->pack(false); ?> </style>
JsPacker
JsPacker与CssPacker的工作方式相同。享受使用吧!