If you have a main class for your CMP, that has a version inside and sets the jsUrl and cssUrl, you could use the following code in the controller class:
class XxxHomeManagerController extends modExtraManagerController
{
/** @var Xxx $xxx */
public $xxx;
public function initialize()
{
$corePath = $this->modx->getOption('xxx.core_path', null, $this->modx->getOption('core_path') . 'components/xxx/');
$this->xxx = $this->modx->getService('xxx', 'Xxx', $corePath . '/model/xxx/', array(
'core_path' => $corePath
));
}
public function loadCustomCssJs()
{
$jsUrl = $this->xxx->getOption('jsUrl') . 'mgr/';
$cssUrl = $this->xxx->getOption('cssUrl') . 'mgr/';
$this->addCss($cssUrl . 'xxx.min.css');
$this->addLastJavascript($jsUrl . 'xxx.min.js?v=v' . $this->xxx->version);
$this->addHtml('<script type="text/javascript">
Ext.onReady(function() {
Xxx.config = ' . $this->modx->toJSON($this->xxx->options) . ';
MODx.load({ xtype: \'xxx-panel-home\'});
});
</script>');
}
}
There is a lot of example code in my free extras available, i.e.
https://github.com/Jako/CustomRequest has a CMP inside.