"name": "briancherne/jquery.hoverintent",Īnd don't forget the indentations and commas.Ĭomposer loves indentations and can't live without the proper commas. The correct procedure here is to use the branch name "master" as reference: In this case, the field "reference" needs the name of a GIT branch. Now if the label does not look like a properly formatted version number, for example "v1.10.2" (notice the V ?) OR if there is NO LABEL, then using the version number will not work, nor will omitting it. Like in the example above, 2.7.2 looks like a fine version number, use it and it will work. IF the library has a LABEL that IS a version number, use that one. it will be used when libraries will be installed or updated. it is a required field in composer, but you can write what you want in there. In some cases, the libraries are names just "cycle", but modules will expect jquery.cycleįill the expected name into that field and all will be fine. even if you load the right library, if it has a different name than expected by the module, it will not work. The name is important, in the example above, modules will look for the name "flexslider" in the libraries folder. Okay, so this is a nice library, it has numbered versions. "reference": "2.7.2" <= important !! see below "type": "drupal-library", <= hey composer, that's a drupal library, remember that type? use the version number if there is one, if not, just write "1" "name": "woothemes/flexslider", <= the name, the second part is important So for that library, we would add the following in the composer.json's "repositiories" section: The GIT link is (found if you press the green "code" button)Īnd version number is also the label, it's 2.7.2 (if labeled, the label is a proper label pictogram at the right side) This library, for example, has a version and a label: GIT libraries are not all equal, some have numbered versions, some don't, some have several branches, or not. This part can be a bit tricky because of the lack of easily understandable documentation. the second part is about defining the library source. What it does is telling composer, hey if you are fed any library of the type "drupal-library", then install it in the path web/libraries/ under its name. Here you see the path already defined, make sure you got something looking like the above. There may be other lines between installer-paths and web/libraries. "type:drupal-library", "type:bower-asset", "type:npm-asset" In your composer.json file, you got a section called "extras" and a subsection "installer paths", such as this: But I'm here to help ! so,the first part is defining an installer path. If you read my other articles, it will be no surprise to you that this is where Drupal documentation often ends. it will then be installed using the above settings define the library source in "repositories".define an "installer path" for "drupal-library".Results: there are three things to do in composer.json So I've spent an hour today with trial and error to find out how libraries can be installed with composer. Downloading and installing libraries for every new site is a PITA.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |