I have a path in a private directory that I want to recreate in a public path. Here is an example of what I mean:
/application
/public
/assets
index.php
/themes
/default
/css
style.css
I want to be able to create/publish, style.css in /public/assets/themes/default/css/style.css for public access. How can I achieve that with Asset Manager?
I have tried the following with no luck:
$di->set('assets', function() {
$assets = new Phalcon\Assets\Manager([
'output'=>realpath(__DIR__.'/assets/'),
'compileAlways'=>false,
'stat'=>true
]);
return $assets;
});
// controller
$css = new \Phalcon\Assets\Resource\Css('/assets/style.css');
$css->setSourcePath(realpath($this->view->getViewsDir().'/../../assets/style.css'));
$css->setTargetPath(APP_PATH.'/assets/style.css');
$css->setLocal(false);
$this->assets->addResourceByType('css', $css);
// view
$this->assets->outputCss();