Yii-ish way to process css/js files before publishing them

Yii-ish way to process (for example, compress) css/js files before publishing them? Seems that there is not something like beforePublish().So where should I put my code for processing assets files?

Take a look at this:


And then check this extension which compresses files, you can either use it or take it as an example and make your own