Okay. First, when user request you page, whole application is loaded to index.php that means that you need to provide path to theme.css/theme.js from index.php directory. Put something like this in your BaseController:
class BaseController extends Controller
{
public function initialize()
{
$moduleName = $this->dispatcher->getModuleName();
$this->assets->setTargetPath("js/combined-$moduleName.js") // its imporant, it will be created under /public/js
->setTargetUri("js/combined-$moduleName.js") // its imporant, its saying in view output there will be that link
->addJs("../apps/$moduleName/js/somefile.js"
->join(true);
// ->addFilter(new Jsmin()) - on production you should add filter
$this->assets->setTargetPath("css/combined-$moduleName.css") // its imporant, it will be created under /public/css
->setTargetUri("css/combined-$moduleName.css") // its imporant, its saying in view output there will be that link
->addCss("../apps/$moduleName/css/somefile.css"
->join(true);
// ->addFilter(new Cssmin()) - on production you should add filter
}
}
Then your controllers should extend BaseController, and this class should be load before loading modules, or load this class in each module - your choice. Also consider changing class to asbtract class - cuz you not gonna ever use it as object/put actions in there.
If you want your files be automatically loaded without putting names there just get all file names in category using scandir and do addCss/addJs for each element.