I just discovered that the official Magento 2.0 release (post public beta) doesn't support loading static assets from a symlinked folder. The root of the problem appears to be here
#File: vendor/magento/framework/View/Design/FileResolution/Fallback/Resolver/Simple.php
if ($this->rootDirectory->isExist($this->rootDirectory->getRelativePath($path))) {
return $path;
}
The call to $this->rootDirectory->getRelativePath
fails if the file doesn't exist under the root Magento directory. So, if you've created a symlink for your module folder
lns app/code/My/Module /path/to/my/other/repository/My/Module
the static file loader application won't be able to find your file.
Does anyone know a workaround for this that doesn't involve
- running
php bin/magento setup:static-content:deploy
whenever you change a file - hacking some code directly into
vendor/magento/framework/View/Design/FileResolution/Fallback/Resolver/Simple.php
to specifically handle your symlink-ed files
Best Answer
there are still some places in Magento 2, which are not compatible with components outside of Magento root. We're working on fixing them. Thanks for reporting, so we would not miss any such place (this one is already in our list).
Unfortunately, I can't suggest any workaround for it now.