workspace/
myapp/
webroot/
index.php
assets/
baz.js
hello/
foo.js
modules/
hello/
assets/
foo.js
bar.js
/ => /workspace/myapp/webroot/index.php
/assets/hello/foo.js => /workspace/myapp/webroot/assets/hello/foo.js
/assets/hello/bar.js => /workspace/myapp/modules/hello/assets/foo.js
/assets/baz.js => /workspace/myapp/webroot/assets/baz.js
In summary:
foo.js
is only present in themodules/hello/assets
folder and gets delivered from there.bar.js
is present both inwebroot/assets/hello
andmodules/hello/assets
and gets delivered fromwebroot
. (it hides/overrides the file inmodules
)baz.js
is only present inwebroot/assets
and gets delivered from there.
The part that doesn't work right now, is this:
location /assets/ {
if (-f $uri) {
break;
}
root /workspace/myapp/modules;
rewrite ^/assets/([^/]+)/(.*)$ /$1/assets/$2 break;
}
Namely the if
directive, doesn't seem to have any affect - the bar.js
file gets delivered from modules
rather than webroot
.