Skip to main content
edited title
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Override a single JavaScript file from a module in Drupal 8

Source Link
mlncn
  • 1.5k
  • 12
  • 20

Override a single JavaScript file from a module in Drupal 8

In my theme's libraries.yml file, after the global-styling section, i'm trying to replace one JavaScript file from the core Toolbar module (it's addition of padding-top to body interferes with our theme, so just changing that to margin-top).

libraries-override:
  toolbar/toolbar:
    js:
      js/views/BodyVisualView.js: js/views/BodyVisualView.js

I repeatedly get the error:

Drupal\Core\Asset\Exception\IncompleteLibraryDefinitionException: Incomplete library definition for definition 'libraries-override' in extension 'mythemename' in Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension() (line 93 of /vagrant/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php).