Yii Combining and Compressing Assets

Hi,I’m having trouble to combine and compress Yii2 assets.I am not able to solve the following scenario.

  • AppHeadAsset contains the main css for the application in the head position

  • AppEndJSAsset contains the JS for the application in the end position. Shared and essential code is supposed to be included here. This one depends on YiiAsset, BootstrapAsset

  • CommentAsset contains code only relevant to the comment process. Should be included as well with the above because it add custom functionality but only relevant to this section ,depends on AppEndJSAsset.
    The asset configuration is given:

    Even with the depends section it include commentAsset before the jquery and the AppEndJsAsset.
    I’m not able to quite figure out what is the problem and the best way of doing this