The Yii resource manager is designed to allow you to pack components such as user interface widgets offline (the alternative is to manually distribute various files in different places within the application directory structure). Therefore, if it makes sense to publish anything as an asset from your component, it makes sense to publish everything as an asset.
In this case, you should structure your component, for example. a
component/ assets/ css/ images/ js/
Then publish the entire assets/ directory using the Yii asset manager, instead of publishing the files one by one. If you do, they will be published as
assets/ random_hash/ css/ images/
Then your CSS can simply reference the images using url(../images/image.jpg) without knowing the random_hash value.
source share