file JsDelivr.php

  1. 8.x-3.x src/Plugin/Provider/JsDelivr.php
  2. 7.x-3.x includes/cdn/JsDelivr.php

Namespace

Drupal\bootstrap\Plugin\Provider
  1. <?php
  2. namespace Drupal\bootstrap\Plugin\Provider;
  3. /**
  4. * The "jsdelivr" CDN Provider plugin.
  5. *
  6. * @ingroup plugins_provider
  7. *
  8. * @BootstrapProvider(
  9. * id = "jsdelivr",
  10. * label = @Translation("jsDelivr"),
  11. * description = @Translation("<a href=:jsdelivr target=_blank>jsDelivr</a> is a free multi-CDN infrastructure that uses <a href=:maxcdn target=_blank>MaxCDN</a>, <a href=:cloudflare target=_blank>Cloudflare</a> and many others to combine their powers for the good of the open source community... <a href=:read_more target=_blank>read more</a>", arguments = {
  12. * ":jsdelivr" = "https://www.jsdelivr.com",
  13. * ":maxcdn" = "https://www.maxcdn.com",
  14. * ":cloudflare" = "https://www.cloudflare.com",
  15. * ":read_more" = "https://www.jsdelivr.com/about",
  16. * }),
  17. * weight = -1
  18. * )
  19. */
  20. class JsDelivr extends ApiProviderBase {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. protected function getApiAssetsUrlTemplate() {
  25. return 'https://data.jsdelivr.com/v1/package/npm/@[email protected]@version/flat';
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. protected function getApiVersionsUrlTemplate() {
  31. return 'https://data.jsdelivr.com/v1/package/npm/@library';
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. protected function getCdnUrlTemplate() {
  37. return 'https://cdn.jsdelivr.net/npm/@[email protected]@version/@file';
  38. }
  39. }

Classes

Name Description
JsDelivr The "jsdelivr" CDN Provider plugin.