sugiphp / assets
SugiPHP Assets Management Component based on Assetic
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-12-14 12:42:24 UTC
README
SugiPHP\Assets simplifies use of a well know asset management framework for PHP Assetic.
CssPacker
Packs and minifies CSS stylesheet files. It can process LESS files as well.
$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 works in a same way as a CssPacker. Enjoy!