Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

including foundation using composer

I try to learn composer, now I want to include (zurb) foundation, so I added "require": {"zurb/foundation": "v5.2.2"} to the composer.json file. After running composer.phar update, I can see that there are some files added to the folder /vendor/zurb/foundation.

But I have no clue how to continue, could anybody please advise how I can start building my web-app now? How do I get it to use the css and js files that are needed for foundation?

I already included the file vendor/autoload.php to my index.php, but that doesn't seem to be enough.

I already built multiple web-sites and apps using foundation, but always "manual", then I just include the right css and js files to the header and footer of the page. Now I just don't know where to start.

thanks for your help.

like image 762
Noweem Avatar asked Oct 20 '22 10:10

Noweem


1 Answers

Check this question first to get the basics: NPM/Bower/Composer - differences?.


Then, if you decide to go with Composer for PHP and Bower for front-end libraries, follow this:

  1. Install Bower using sh $ npm install -g bower (you'll need Node.js and npm first)
  2. Configure Bower for you front-end packages (visit Bower docs for more information)

    {
      "name": "MyProject",
      "dependencies": {
        "foundation": "*"
      }
    }
    
  3. Hook Bower to Composer adding this to your composer.json

    "scripts": {
      "post-install-cmd": [
        "bower install"
      ],
      "post-update-cmd": [
        "bower install"
      ],
    }
    

Now every time you hit composer update (or install), bower components get updated as well!

like image 136
Bugs Bunny Avatar answered Oct 24 '22 00:10

Bugs Bunny