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
isExists()
method which adds the absolute path (of the Magento root) to the relative path, to check whether it exists. There simply should be an extra check that checks whether the relative path is in fact already an absolute path. I will submit a PR for this.mount -o bind
instead of symlinking.