Skip to content

Commit 951df34

Browse files
authored
All: Fix CDN links
Make the fallback to the default CDN origin applied in all places the previous `cdn_origin` setting was read. Fixes gh-92 Closes gh-93
1 parent 62f130c commit 951df34

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Gruntfile.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ var _ = require( "lodash" ),
77
Handlebars = require( "handlebars" ),
88
http = require( "http" );
99

10+
const CDN_ORIGIN = "https://code.jquery.com";
11+
1012
grunt.loadNpmTasks( "grunt-jquery-content" );
1113
grunt.loadNpmTasks( "grunt-sri" );
1214

@@ -323,7 +325,7 @@ grunt.registerTask( "build-index", function() {
323325

324326
function cdnSriLink( file, label ) {
325327
var sri = "sha256-" + sriHashes[ `@cdn/${ file }` ].hashes.sha256,
326-
cdnOrigin = grunt.config( "wordpress" ).cdn_origin || "https://code.jquery.com";
328+
cdnOrigin = grunt.config( "wordpress" ).cdn_origin || CDN_ORIGIN;
327329
return `<a
328330
class='open-sri-modal'
329331
href='${ cdnOrigin }/${ file }'
@@ -332,7 +334,7 @@ grunt.registerTask( "build-index", function() {
332334
}
333335

334336
function cdnLink( file, label ) {
335-
var cdnOrigin = grunt.config( "wordpress" ).cdn_origin;
337+
var cdnOrigin = grunt.config( "wordpress" ).cdn_origin || CDN_ORIGIN;
336338
return `<a href='${ cdnOrigin }/${ file }'>${ label }</a>`;
337339
}
338340

@@ -383,7 +385,7 @@ grunt.registerTask( "build-index", function() {
383385

384386
Handlebars.registerHelper( "uiTheme", function( release ) {
385387
var url,
386-
cdnOrigin = grunt.config( "wordpress" ).cdn_origin;
388+
cdnOrigin = grunt.config( "wordpress" ).cdn_origin || CDN_ORIGIN;
387389

388390
// TODO: link to minified theme if available
389391
if ( release.themes.indexOf( "smoothness" ) !== -1 ) {

0 commit comments

Comments
 (0)