After running update.php, I ran into the problem that the CDN theme was not loaded anymore. I cleared cache houndreds of times, restarted Apache, ran cron, rebuild theme registry, disabled/re-enabled jQuery Update, updated Bootstrap theme to latest dev... but jsDelivr options didn't return.

jsDevilr options broken

Did the mechanism for retrieving the jsDelivr option change?

I reproduced on another site with the same steps: run update.php, then go the to theme setting.

Bootstrap theme: latest dev, jquery set to 1.9 standard, 1.7 for administration

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Daniel Schaefer’s picture

Issue summary: View changes
FileSize
65.6 KB
dozer55’s picture

I can confirm the same behavior.

m.stenta’s picture

Confirmed, same issue here.

m.stenta’s picture

Version: 7.x-3.1-beta2 » 7.x-3.x-dev

This is actually an issue in the current dev branch.

kumkum29’s picture

Same problem for me...

m.stenta’s picture

Status: Active » Needs review
FileSize
611 bytes

The problem is that jsDelivr started calling Bootstrap "twitter-bootstrap" instead of "bootstrap".

Patch attached.

dunlop’s picture

Same problem for me.

Temporary workaround is to use another CDN Provider set under Custom:

//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css
//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js
//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.css
//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.js

Change 3.3.4 in above to your preferred version.

I can confirm that using this CDN does work for me.

dunlop’s picture

Patch in #6 works for me. No need for the workaround I gave.

amorsent’s picture

FYI - If you've saved your theme settings while it was broken, you may also need to go back and correct the cdn settings after applying the patch.

Daniel Schaefer’s picture

Status: Needs review » Reviewed & tested by the community

Just applied the patch on both sites and it works well. Thank you m.stenta for your help!

I will set this to RTBC so we can commit quickly.

markhalliwell’s picture

Component: Theme settings » Code

This happened due to a regression introduced in jsDelivr's API v1 (likely due to work on v2). I have filed an issue with them: https://github.com/jsdelivr/api/issues/94

The real "problem" is that the "bootstrap" alias (provided by BootstrapCDN) is no longer being picked up (by jsDelivr API v1). "twitter-bootstrap" has always existed.

I'm tempted to mark this as "Closed (won't fix)" or "Closed (works as designed)" and just wait for them to fix their mistake (and to wait for v2), but this is a relatively minor change. I will commit shortly.

  • markcarver committed a2e9cd1 on 7.x-3.x
    Issue #2504343 by m.stenta: jsDelivr options broken
    

  • markcarver committed f7f3195 on
    Issue #2504343 by m.stenta: jsDelivr options broken
    
markhalliwell’s picture

Status: Reviewed & tested by the community » Fixed
markhalliwell’s picture

FWIW, the "bootstrap" alias has been fixed and is back in v1: http://api.jsdelivr.com/v1/bootstrap/libraries?name=bootstrap

m.stenta’s picture

Status: Fixed » Needs work

@markcarver: Thanks for the quick response!

Unfortunately, the commit you made does not work.

Take a look at line 169:

${$data['name']}[$asset['version']] = $asset['files'];

And here it is in context:

  // Extract the raw asset files from the JSON data for each framework.
  $bootstrap = array();
  $bootswatch = array();
  foreach ($json as $data) {
    if ($data['name'] === 'bootswatch' || $data['name'] === 'twitter-bootstrap') {
      foreach ($data['assets'] as $asset) {
        if (preg_match('/^' . BOOTSTRAP_VERSION_MAJOR . '\.\d\.\d$/', $asset['version'])) {
          ${$data['name']}[$asset['version']] = $asset['files'];
        }
      }
    }
  }

With your change, that line of code will be trying to set a variable named $twitter-bootstrap, but it needs to be setting the $bootstrap variable. I tried your change first, and ran into that issue, which is why I ultimately just added a line to translate "twitter-bootstrap" into "bootstrap" instead (minimally invasive, but sticking with the existing conventions in the code).

Changing this back to Needs Work.

  • markcarver committed c37eab0 on 7.x-3.x
    Issue #2504343 by m.stenta: jsDelivr options broken
    

  • markcarver committed 2e2d13c on 8.x-3.x
    Issue #2504343 by m.stenta: jsDelivr options broken
    
markhalliwell’s picture

Status: Needs work » Fixed

@m.stenta, you are correct. Might have helped if I had actually tested the change before committing, my bad.

dynamic variables--

I've opted for using a $libraries array instead to get rid of the dynamic variable bit (I knew this would come back to bite me in the a$$) and then re-purposed the $bootstrap and $bootswatch variables to be the expected jsDelivr library names.

markhalliwell’s picture

Also I feel like I should have further explained why I chose to not use the patch in #6.

I tried your change first, and ran into that issue, which is why I ultimately just added a line to translate "twitter-bootstrap" into "bootstrap" instead (minimally invasive, but sticking with the existing conventions in the code)

Arbitrarily changing a raw response value is never really a good idea and is generally considered bad "best practice". It can lead to hours of confusion as to "why" or "where" this change occurred (as it would differ from the original API response). Also, I knew they would likely put it back in (which they did, rather quickly) and thus we would have duplicate libraries on our hands.

m.stenta’s picture

@markcarver: You're right. I shouldn't have been changing a raw response value... bad. Oh well, glad you got a new fix worked out!

And yea... dynamic variables are definitely another one of those someday-gotchas. :-)

Thanks again!

  • markcarver committed 79c57f1 on
    Issue #2504343 by m.stenta: jsDelivr options broken
    

  • markcarver committed f91f609 on 8.x-3.x
    Issue #2504343 by m.stenta: jsDelivr options broken
    
    Conflicts:
    includes...
markhalliwell’s picture

No worries. This actually has helped with the "what happens when" scenario.

I've gone ahead and committed more fixes so that it moves the "error" handling up a little when the main twitter-bootstrap library isn't found whether it be from bad HTTP request or something like this (where the request was successful, but the library name didn't exist in the response).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ytsurk’s picture

GOSH - they changed it back to bootstrap ...

aka oops they did it again ..

I made this new issue:
#2842944: jsDeliver name change back to bootstrap