Skip to main content
writing about the state of other answers is dangerous because no one knows how they will change over time
Source Link
Patrick Kenny
  • 29.3k
  • 19
  • 139
  • 316

Other answers seem to skip important info. If you have the same code from your question in your subtheme.libraries.yml file, but it isn't showing up, you still need to add that library to your subtheme.info.yml file

subtheme.info.yml

name: Subtheme Name
type: theme
description: 'A theme description.'
core_version_requirement: ^8 || ^9
base theme: bartik
libraries:
  - subthemename/global-styling
  - subthemename/font-awesome
  - subthemename/bootstrap

subtheme.libraries.yml

global-styling:
  css:
    theme:
      css/styles.css: {}
  js:
    js/scripts.js: {}

font-awesome:
  remote: https://fortawesome.github.io/Font-Awesome/
  version: 4.5.0
  license:
    name: MIT
    url: https://fortawesome.github.io/Font-Awesome/license/
    gpl-compatible: true
  css:
    theme:
      https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css: { type: external, minified: true }

bootstrap:
  remote: https://getbootstrap.com/docs/5.1/
  version: 5.1
  license:
    name: MIT
    url: https://getbootstrap.com/docs/5.1/about/license/
    gpl-compatible: true
  css:
    theme:
      https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css: { type: external, minified: true }
  js:
    https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js:  { type: external, minified: true }

Put another way, you first need to specify the library names in your info.yml file then define them in your libraries.yml file.

Other answers seem to skip important info. If you have the same code from your question in your subtheme.libraries.yml file, but it isn't showing up, you still need to add that library to your subtheme.info.yml file

subtheme.info.yml

name: Subtheme Name
type: theme
description: 'A theme description.'
core_version_requirement: ^8 || ^9
base theme: bartik
libraries:
  - subthemename/global-styling
  - subthemename/font-awesome
  - subthemename/bootstrap

subtheme.libraries.yml

global-styling:
  css:
    theme:
      css/styles.css: {}
  js:
    js/scripts.js: {}

font-awesome:
  remote: https://fortawesome.github.io/Font-Awesome/
  version: 4.5.0
  license:
    name: MIT
    url: https://fortawesome.github.io/Font-Awesome/license/
    gpl-compatible: true
  css:
    theme:
      https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css: { type: external, minified: true }

bootstrap:
  remote: https://getbootstrap.com/docs/5.1/
  version: 5.1
  license:
    name: MIT
    url: https://getbootstrap.com/docs/5.1/about/license/
    gpl-compatible: true
  css:
    theme:
      https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css: { type: external, minified: true }
  js:
    https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js:  { type: external, minified: true }

Put another way, you first need to specify the library names in your info.yml file then define them in your libraries.yml file.

If you have the same code from your question in your subtheme.libraries.yml file, but it isn't showing up, you still need to add that library to your subtheme.info.yml file

subtheme.info.yml

name: Subtheme Name
type: theme
description: 'A theme description.'
core_version_requirement: ^8 || ^9
base theme: bartik
libraries:
  - subthemename/global-styling
  - subthemename/font-awesome
  - subthemename/bootstrap

subtheme.libraries.yml

global-styling:
  css:
    theme:
      css/styles.css: {}
  js:
    js/scripts.js: {}

font-awesome:
  remote: https://fortawesome.github.io/Font-Awesome/
  version: 4.5.0
  license:
    name: MIT
    url: https://fortawesome.github.io/Font-Awesome/license/
    gpl-compatible: true
  css:
    theme:
      https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css: { type: external, minified: true }

bootstrap:
  remote: https://getbootstrap.com/docs/5.1/
  version: 5.1
  license:
    name: MIT
    url: https://getbootstrap.com/docs/5.1/about/license/
    gpl-compatible: true
  css:
    theme:
      https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css: { type: external, minified: true }
  js:
    https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js:  { type: external, minified: true }

Put another way, you first need to specify the library names in your info.yml file then define them in your libraries.yml file.

Source Link

Other answers seem to skip important info. If you have the same code from your question in your subtheme.libraries.yml file, but it isn't showing up, you still need to add that library to your subtheme.info.yml file

subtheme.info.yml

name: Subtheme Name
type: theme
description: 'A theme description.'
core_version_requirement: ^8 || ^9
base theme: bartik
libraries:
  - subthemename/global-styling
  - subthemename/font-awesome
  - subthemename/bootstrap

subtheme.libraries.yml

global-styling:
  css:
    theme:
      css/styles.css: {}
  js:
    js/scripts.js: {}

font-awesome:
  remote: https://fortawesome.github.io/Font-Awesome/
  version: 4.5.0
  license:
    name: MIT
    url: https://fortawesome.github.io/Font-Awesome/license/
    gpl-compatible: true
  css:
    theme:
      https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css: { type: external, minified: true }

bootstrap:
  remote: https://getbootstrap.com/docs/5.1/
  version: 5.1
  license:
    name: MIT
    url: https://getbootstrap.com/docs/5.1/about/license/
    gpl-compatible: true
  css:
    theme:
      https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css: { type: external, minified: true }
  js:
    https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js:  { type: external, minified: true }

Put another way, you first need to specify the library names in your info.yml file then define them in your libraries.yml file.