Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<!-- fallback to dns-prefetch for iOS where preconnect isn't supported yet -->
<link rel="dns-prefetch" href="https://vignette.wikia.nocookie.net">

<link rel="stylesheet" href="/mobile-wiki/assets/app.css">
<script src="/mobile-wiki/assets/vendor.js" defer></script>
<script src="/mobile-wiki/assets/mobile-wiki.js" defer></script>
<link rel="stylesheet" href="/mobile-wiki/br/assets/app.css">
<script src="/mobile-wiki/br/assets/vendor.js" defer></script>
<script src="/mobile-wiki/br/assets/mobile-wiki.js" defer></script>
<script>
window.M = {};
</script>
Expand All @@ -33,14 +33,14 @@
{{content-for 'rubik-font'}}
{{content-for 'svg-inline'}}
{{content-for 'body'}}
<script src="/mobile-wiki/assets/wikia-opt-in.min.js"></script>
<script src="/mobile-wiki/br/assets/wikia-opt-in.min.js"></script>
{{content-for 'fastboot-inline-scripts'}}
{{content-for 'fastboot-inline-scripts-tracking'}}
{{content-for 'fastboot-inline-scripts-load-svg'}}

<script>
(function (M) {
M.loadDOMResource('/mobile-wiki/assets/design-system.svg');
M.loadDOMResource('/mobile-wiki/br/assets/design-system.svg');
})(window.M);
</script>

Expand Down
4 changes: 2 additions & 2 deletions app/modules/jwplayer-assets.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Promise } from 'rsvp';

export const assetUrls = {
styles: '/mobile-wiki/assets/jwplayer/index.css',
script: '/mobile-wiki/assets/jwplayer/wikiajwplayer.js',
styles: '/mobile-wiki/br/assets/jwplayer/index.css',
script: '/mobile-wiki/br/assets/jwplayer/wikiajwplayer.js',
};

/**
Expand Down
4 changes: 2 additions & 2 deletions app/templates/head.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@

{{#if model.lazyCss}}
{{!- These styles will be added to head on front-end to lazy load them-}}
<link rel="stylesheet" href="/mobile-wiki/assets/lazy.css">
<link rel="stylesheet" href="/mobile-wiki/br/assets/lazy.css">
{{/if}}

{{#if model.shouldLoadDarkCss}}
{{!- Styles for dark theme added only in the mobile app view-}}
<link rel="stylesheet" href="/mobile-wiki/assets/dark.css">
<link rel="stylesheet" href="/mobile-wiki/br/assets/dark.css">
{{/if}}
31 changes: 31 additions & 0 deletions config/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-env node */

'use strict';

module.exports = function (deployTarget) {
const ENV = {
build: {
outputPath: 'dist/mobile-wiki',
},
// include other plugin configuration that applies to all deploy targets here
compress: {
compression: ['gzip', 'brotli'],
keep: true,
},
};

if (deployTarget === 'development') {
ENV.build.environment = 'development';
// configure other plugins for development deploy target here
}

if (deployTarget === 'production') {
ENV.build.environment = 'production';
// configure other plugins for production deploy target here
}

// Note: if you need to build some configuration asynchronously, you can return
// a promise that resolves with the ENV object instead of returning the
// ENV object synchronously.
return ENV;
};
6 changes: 3 additions & 3 deletions fastboot-server/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ module.exports = function (req, res, next) {
try {
// We do want to load this file in runtime and have a fallback if it does not exist
/* eslint global-require: 0 */
vendorAssetPath = require('../dist/mobile-wiki/assets/assetMap.json').assets['assets/vendor.js'];
vendorAssetPath = require('../dist/mobile-wiki/br/assets/assetMap.json').assets['assets/vendor.js'];
} catch (exception) {
vendorAssetPath = 'assets/vendor.js';
vendorAssetPath = '/br/assets/vendor.js';
}
}

if (!req.path.startsWith('/mobile-wiki/assets')) {
if (!req.path.startsWith('/mobile-wiki/br/assets')) {
res.setHeader('link', `</mobile-wiki/${vendorAssetPath}>; rel=preload; as=script`);
}

Expand Down
3 changes: 2 additions & 1 deletion fastboot-server/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function levelFn(status) {

module.exports = {
before(app) {
app.use(compression());
app.use(/^(?!\/mobile-wiki\/)/, compression());
app.disable('x-powered-by');
app.use(logger);

Expand All @@ -45,6 +45,7 @@ module.exports = {
app.use(/^(\/[a-z]{2,3}(?:-[a-z-]{2,12})?)?\/article-preview/, methodOverride(() => 'GET'));

app.use('/mobile-wiki', cors(), staticAssets);
app.use('/mobile-wiki/br/', cors(), staticAssets);
app.use('/heartbeat', heartbeat);
},

Expand Down
14 changes: 8 additions & 6 deletions fastboot-server/static-assets.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const express = require('express');
const expressStaticGzip = require('express-static-gzip');
const config = require('../config/fastboot-server');

module.exports = express.static(config.distPath, {
setHeaders: (res) => {
res.set('Cache-Control', `s-maxage=${config.staticAssetsTTL}`);
res.set('X-Pass-Cache-Control', `public, max-age=${config.staticAssetsTTL}`);
res.set('Vary', 'accept-encoding');
module.exports = expressStaticGzip(config.distPath, {
enableBrotli: true,
serveStatic: {
setHeaders: (res) => {
res.set('Cache-Control', `s-maxage=${config.staticAssetsTTL}`);
res.set('X-Pass-Cache-Control', `public, max-age=${config.staticAssetsTTL}`);
},
},
});
Loading