SU-SWS / decanter

A collection of front end web resources.
GNU General Public License v3.0
40 stars 9 forks source link

Add composer.json #169

Closed sherakama closed 5 years ago

sherakama commented 6 years ago

Add a composer.json file so you can add this project as a dependency in PHP projects.

JBCSU commented 6 years ago

@sherakama I was able to use composer to include decanter in my WordPress theme without changing anything in this repo. Here are the relevant bits of my theme's composer.json:

  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    },
    {
      "type": "package",
      "package": {
        "name": "stanford/decanter",
        "version": "3.0.0",
        "source": {
          "type": "git",
          "url": "git@github.com:SU-SWS/decanter.git",
          "reference": "origin/master"
        }
      }
    }
  ],
  "require": {
    "timber/timber": "^1.7",
    "stanford/decanter": "3.0.*"
  },

So that's all lovely, except installing decanter with composer as above does not also include Decanter's dependencies, e.g. Bourbon, Neat, normalize, ....

Is there a goal of creating a completely self-contained decanter.scss, or will we require anyone who builds on top of decanter to use npm in order to get decanter's dependencies?

sherakama commented 6 years ago

Hey @JBCSU ,

Thanks for this. Decanter has dependencies that will be required to use it and I don't see us going completely pure and home baked as we really do utilize our dependencies well. NPM is a great tool for managing dependencies in the JS/CSS world and we have used it in this project. As composer is PHP's dependency manager it can mirror what NPM does to a degree. The repositories in which we pull from in NPM are not the same as the ones we pull from in composer. I have seen plugins and other adoptions of components in composer that allow a PHP project to pull from npmjs and bower. It may have been this one: https://packagist.org/packages/fxp/composer-asset-plugin

In any case, we should add a composer.json file with the correct "type" and list of dependencies.

sherakama commented 5 years ago

composer.json is available.