Some zf2 modules have public directories for distribution of resources such as js/css/images. What is best practice for making these resouces available to the applicaiton?
I would like it so that these resources were automatically available through http://mysite.com/[moduleName]/
. For example,
root/public/js/sitescript.js
--> http:\\mysite.com\js\sitescript.js
root/module/mymodule/public/js/modulescript.js
--> http:\\mysite.com\mymodule\js\modulescript.js
root/vendor/vendormodule/public/js/vendorscript.js
--> http:\\mysite.com\vendormodule\js\vendorscript.js
Should these resources be copied to the root/public directory? Manual copying will be painful, and I doubt an automated build process to merge the directories would be very practial either.
Perhaps there is some magic that can be worked with httpd.conf or .htaccess?
Perhaps symlinks are the solution? But, symlinks are not straight forward to get going on a Windows platform, and would need to be created manually for each individual module.
There are 4 ways of handling this:
public/
directorypublic/
directoryUse an asset-manager module, such as one of the following:
public/
dir at deploy timeIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With