Reputation: 528
I want to be able to, at build-time, submit a group of CSS files and have the following done:
I'm sure there are others, but this what I'm starting with.
This is the preference order of how I would like to access the tool:
I saw CSS Compressor, but it doesn't seem to combine CSS files nor does it combine overlapping CSS selectors.
Thanks in advance.
Upvotes: 5
Views: 5348
Reputation: 1
You should use sCSSOptimizer.
If you want to compile more than one css files than do like this
<?php
require('./sCSSOptimizer/scssoptimizer.class.php');
$css1 = file_get_contents("./cssfile1.css");
$css2 = file_get_contents("./cssfile2.css");
$final_css = $css1.$css2; //you can join more, if you want...
$scss = new sCSSOptimizer($final_css);
//$compression_rate = $scss->getCompressionRate();
$compressed_css = $scss->getOptimized();
//do your stuff
?>
.
Upvotes: 0
Reputation: 13457
You could try Chirpy. It will combine and compress files and v2 has a command line interface.
I've only ever run it within Visual Studio though.
Upvotes: 0
Reputation: 38289
I would recommend the YUI compressor since it is widely used and has a command line interface.
You should also consider making your build process automated so that you can build everything with a single command. If you don't want to use an existing build tool you could create a short .bat
file for this kind of task.
First, combine your files:
type file1.css file2.css file3.css > combined.css
then pass it to the YUI compressor:
java -jar yuicompressor.jar combined.css > combined-min.css
Upvotes: 4