1

I am running a couple of test sites under Drupal 8, installing them using Composer. Bower_components seem to be living in two places.

/vendor/civicrm/civicrm-core/bower_components/

and

/web/libraries/civicrm/bower_components/

Which is the 'right' one, or is there an issue where files are duplicated?

1

It's both. One of the main issues with civicrm+drupal8 is that drupal 8 (correctly) doesn't allow web access to files in the vendor folder, since that can be a security issue. Both roundearth and civicrm-asset-plugin try to deal with it, just a bit differently, by copying the files to a web-accessible folder, via composer events that are triggered when you run composer.

It doesn't copy all files, just the ones needed. It is possible for them to get out of sync if for whatever reason the composer event doesn't trigger, but you can re-sync by deleting the one under /web/libraries and running composer install again. You may need to delete one the /vendor bower_components subfolders to get that to trigger it. I never know what composer is really looking at when it decides what to do.

UPDATE: If you're using the civicrm/civicrm-asset-plugin (as opposed to roundearth), running composer civicrm:publish from the top folder (above vendor) will re-sync the appropriate files from vendor to web. For roundearth, I haven't tested this but it might work to use composer civicrm:sync-web-assets, also from the top folder.

  • I tried deleting both and running composer install again, but it failed to create the bower_components under /web/libraries/civicrm/. – Stephen Palmstrom Apr 27 '20 at 15:04
  • Argh, composer. It might need something bigger to trigger the plugin, like removing vendor/civicrm/civicrm-core and then running composer install again. On the plus side that should install from cache so should be quick. (If anything with composer could be called quick - let's go with "not too slow".) – Demerit Apr 27 '20 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.