Hello,

I installed the theme "Bootstrap" with "Composer".

I want to download "Font Awesome" in my subtopic "Bootstrap".

How to add "Font Awesome" library to "Bootstrap"?

Comments

zenimagine created an issue. See original summary.

markhalliwell’s picture

Category: Feature request » Support request
Status: Active » Closed (works as designed)
zenimagine’s picture

thank you. But I installed "Drupal 8" with "Composer".

How do I install "Font Awesome" with "Composer"?

NexusStar’s picture

You can use composer require drupal/fontawesome this will install it as module. If you have in your `composer.json` file

    "extra": {
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/modules/custom/{$name}": ["type:drupal-custom-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "web/themes/custom/{$name}": ["type:drupal-custom-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"]
        }

it will be installed under web/modules/contrib and will be added as requirement to the project

brooke_heaton’s picture

You may need to add fontawesome to your 'repositories' array in your composer.json

 "repositories": [
    {
      "type": "package",
      "package": {
        "name": "fontawesome/font-awesome",
        "version": "5.0.6",
        "type": "drupal-library",
        "dist": {
          "url": "https://github.com/FortAwesome/Font-Awesome/releases/download/5.0.6/fontawesome-free-5.0.6.zip",
          "type": "zip"
        },
        "extra": {
          "installer-name": "fontawesome"
        },
        "require": {
          "composer/installers": "^1.2.0"
        }
      }
    },
  ],

After adding that, you should use 'composer require fontawesome/font-awesome' to add the fontawesome library. Note that in the 'repositories' array that I am installing it as a 'drupal-library' but with the name 'fontawesome'. As NexusStar notes, in order for the library to be installed in your 'libraries' direcotry, you need to add the install-paths with your appropriate path, which may be "web/libraries/{$name}": ["type:drupal-library"], or perhaps "web/libraries/{$name}": ["type:drupal-library"] depending on your situation.