Skip to content
Snippets Groups Projects
Verified Commit 87cc6994 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Added preprendering for all pages/locales

parent 8fb8842a
No related branches found
No related tags found
No related merge requests found
Pipeline #3759 failed with stage
in 1 minute and 34 seconds
......@@ -4,10 +4,11 @@ stages:
pages:
stage: build
image: funkwhale/front-base
image: buildkite/puppeteer
variables:
GIT_STRATEGY: clone
before_script:
- apt-get update && apt-get install -y jq
- yarn install
script:
- yarn lint
......
#!/bin/bash -eux
locales=$(tail -n +2 src/locales.js | sed -e 's/export default //' | jq '.locales[].code' | xargs echo)
locales=$(tail -n +2 src/locales.js | sed -e 's/module.exports = //' | jq '.locales[].code' | xargs echo)
mkdir -p src/translations
for locale in $locales; do
......
#!/bin/bash -eux
locales=$(tail -n +2 src/locales.js | sed -e 's/export default //' | jq '.locales[].code' | xargs echo)
locales=$(tail -n +2 src/locales.js | sed -e 's/module.exports = //' | jq '.locales[].code' | xargs echo)
locales_dir="locales"
sources=$(find src -name '*.vue' -o -name '*.html' 2> /dev/null)
js_sources=$(find src -name '*.vue' -o -name '*.js')
......
/* eslint-disable */
export default {
module.exports = {
"locales": [
{
"code": "en_US",
......
// locales = required('src/locales')
// const path = require("path");
// const PrerenderSPAPlugin = require("prerender-spa-plugin");
const locales = require("./src/locales");
const path = require("path");
const PrerenderSPAPlugin = require("prerender-spa-plugin");
module.exports = {
// configureWebpack: config => {
// if (process.env.NODE_ENV !== 'production') return
// return {
// plugins: [
// new PrerenderSPAPlugin(
// // Absolute path to compiled SPA
// path.resolve(__dirname, 'dist'),
// // List of routes to prerender
// [ '/', '/code-of-conduct', '/community'],
// {
// // options
// }
// ),
// ]
// }
// }
configureWebpack: config => {
if (process.env.NODE_ENV !== "production") return;
let baseRoutes = ["/", "/code-of-conduct", "/community", "/contact"];
let finalRoutes = [];
baseRoutes.forEach(p => {
finalRoutes.push(p);
locales.locales.forEach(l => {
finalRoutes.push("/" + l.code + p);
});
});
return {
plugins: [
new PrerenderSPAPlugin(
// Absolute path to compiled SPA
path.resolve(__dirname, "dist"),
// List of routes to prerender
finalRoutes,
{
// options
}
)
]
};
}
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment