As already discussed before on this platform assets such as Bootstrap and jQuery can be loaded via Bower. This package manager automatically puts all libraries in the public_html/components folder. Cloud hosting companies do not necessarily support Bower so this represents a problem. The alternative is Composer that is used for all back-end dependencies anyway. Luckily both libraries Bootstrap and jQuery are available as components so in step 1 they are added to the composer.json file

"require": {
       ............
        "components/bootstrap": "^3.3",
        "components/jquery": "^2.1",
     .........               
    },

The libraries are placed in the vendor/components directory so all that is left to be done is moving them somehow to the public/components directory. Easier said than done. It should be possible to have Composer define a component dir:

"config": {
        "component-dir": "public_html"
    }

but the documentation is vague and any attempt to getting it work fails. Symlinks then. Remember that the development for this projects takes place in an Xampp/Windows environment. Creating one of this symlinks with the command shell or Git Bash and keeping in mind all user privileges simply failed (permission denied). Luckily the problem can be solved in the httpd-vhosts.conf:

    ........
	Alias /components "C:/xampp/htdocs/zf2project/vendor/components"
........

Solved! For the production deployment the creation of a symlink is handled in the usual way.

Advertisements