Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
tryout polyfill bundle on same domain (#837)
Browse files Browse the repository at this point in the history
* tryout polyfill bundle on same domain

* force https
  • Loading branch information
wheresrhys committed Mar 6, 2017
1 parent 44918d9 commit ef156e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion node/lib/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,17 @@ function init (options, directory, locals) {
res.locals.nUiConfig = nUiConfig;

// work out which assets will be required by the page
const polyfillRoot = `//${flags.polyfillQA ? 'qa.polyfill.io' : 'next-geebee.ft.com/polyfill'}/v2/polyfill.min.js`;

let polyfillRoot;

if (flags.polyfillQA) {
polyfillRoot = 'https://qa.polyfill.io/v2/polyfill.min.js';
} else if (flags.polyfillSameDomain) {
polyfillRoot = 'https://www.ft.com/__origami/service/polyfill/v2/polyfill.min.js';
} else {
polyfillRoot = 'https://next-geebee.ft.com/polyfill/v2/polyfill.min.js';
}


res.locals.polyfillCallbackName = nPolyfillIo.callbackName;
res.locals.polyfillUrls = {
Expand Down
2 changes: 1 addition & 1 deletion node/test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe('simple app', function () {
it('should preload main.css, main-with-n-ui.js and polyfill', done => {
request(app)
.get('/templated')
.expect('Link', /<\/\/next-geebee\.ft\.com\/.*polyfill.min\.js.*>; as="script"; rel="preload"; nopush/)
.expect('Link', /<https:\/\/next-geebee\.ft\.com\/.*polyfill.min\.js.*>; as="script"; rel="preload"; nopush/)
.expect('Link', /<\/\/www\.ft\.com\/__assets\/n-ui\/cached\/v1\.1\.1\/es5\.min\.js>; as="script"; rel="preload"; nopush/)
.expect('Link', /<\/demo-app\/main-without-n-ui\.js>; as="script"; rel="preload"; nopush/, done)
});
Expand Down

0 comments on commit ef156e4

Please sign in to comment.