Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up for the issue I created: https://github.com/MaxCDN/bootstrap-cdn/issues/460
Instead of statically providing the supported CDN versions for both Bootstrap and Bootswatch, we should instead populate them dynamically via the jsdelivr API.
Comment | File | Size | Author |
---|---|---|---|
#20 | provide_a_more_robust-2450757-20.patch | 99.46 KB | neardark |
#9 | bootstrap-provide-a-more-robust-2450757-9.patch | 78.63 KB | markhalliwell |
Comments
Comment #1
waverate CreditAttribution: waverate commentedMark,
This looks good for Bootstrap:
http://maxcdn.bootstrapcdn.com/data/bootstrapcdn.json
Comment #2
markhalliwellThat's just for Bootstrap. In the GH issue I linked, I learned that file is automatically generated from http://api.jsdelivr.com/v1/bootstrap/libraries. Considering that this JSON data has both Bootstrap and Bootswatch, I think it'd be better to use that one directly.
Comment #3
markhalliwellInitial WIP (non-working) patch of dynamic CDN
Comment #4
markhalliwellSigh... it didn't add the new file... trying again...
Comment #5
markhalliwellComment #6
waverate CreditAttribution: waverate commentedMark,
Against latest 7.x-3.x-dev, I get a WSOD on the settings page. From log:
Notice: Use of undefined constant BOOTSTRAP_MAJOR_VERSION - assumed 'BOOTSTRAP_MAJOR_VERSION' in _bootstrap_cdn_api() (line 113 of sites/all/themes/bootstrap/includes/cdn.inc).
Using php 5.4.38
Comment #7
Christopher Riley CreditAttribution: Christopher Riley commentedI ran into the same issue. It appears that it is not reading the define out of template.php. I added the same define to the top of includes/cdn.php and it works and does not give a already defined message. I added a line to the top of template.php saying it was loaded and another at the top of cdn.php and I see the message about cdn.php but not template.php.
How does the loading order work with a subtheme? Could this be a subtheme related issue? For the time being I moved the define over to cdn.php and all is working but would love to see this cleaned up and implemented.
Thanks in advance.
Comment #8
markhalliwellI would have thought this was pretty self-explanatory...
Comment #9
markhalliwellFinal patch
Comment #10
markhalliwellOk. I think this is "done" and ready for review/testing.
@neardark, please advise. Doesn't have to be ported to 8.x just yet. Just need as many eyes as possible on this.
Comment #11
markhalliwellComment #12
neardark CreditAttribution: neardark commentedOnly two minor minor items noted below. I need to re-review when my mind is clear, but this looks great. I did install, and it worked well.
it's should be its
%21 should be a forward slash I believe.
Comment #13
waverate CreditAttribution: waverate commentedPatch #9 with #12 changes works.
Comment #15
markhalliwellOk, I addressed #12.1. #12.2 is correct, API doesn't recognize a forward slash there.
Moving this to 8.x-3.x for port and more review. If there's any further issues found with this work, please open a new issue to address.
I'll be creating a change record for this issue.
Comment #16
markhalliwellPublished change record: https://www.drupal.org/node/2452617
Comment #20
neardark CreditAttribution: neardark commentedComment #22
neardark CreditAttribution: neardark commentedComment #24
PolHi all,
I made a Libraries API integration module with CDN, you can find it here: https://www.drupal.org/project/libraries_cdn
It might certainly help you managing your CDN in a easy way.