Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
JosephK
framatalk
Commits
48e9b335
Commit
48e9b335
authored
Jan 26, 2021
by
JosephK
Browse files
♻
️ vue-fs 21.1.19 (+
💅
carousel)
parent
f2e67009
Pipeline
#383679
passed with stages
in 1 minute and 28 seconds
Changes
11
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
48e9b335
...
...
@@ -6,3 +6,4 @@ npm-debug.log
pnpm-lock.yaml
tools/backup/
tools/tmp/
app/locales/*/sfs.yml
app/App.vue
View file @
48e9b335
...
...
@@ -24,6 +24,17 @@
'meta[name^=twitter][name$=description]': {content: meta.description},
'meta[name=author]': {content: meta.author},
'link#preload-0': preload[0],
'link#preload-1': preload[1],
'link#preload-2': preload[2],
'link#preload-3': preload[3],
'link#preload-4': preload[4],
'link#preload-5': preload[5],
'link#preload-6': preload[6],
'link#preload-7': preload[7],
'link#preload-8': preload[8],
'link#preload-9': preload[9],
}"
/>
<header-component
/>
...
...
@@ -42,19 +53,46 @@ export default {
},
data
()
{
const
description
=
this
.
$te
(
`meta.
${
this
.
$route
.
meta
.
id
}
.description`
)
?
this
.
$t
(
`meta.
${
this
.
$route
.
meta
.
id
}
.description`
)
:
this
.
$t
(
'
meta.description
'
,
'
-t
'
);
/* Title */
let
title
=
this
.
$t
(
'
meta.title
'
,
'
-t
'
);
// Main title
if
(
this
.
$te
(
`
${
this
.
$route
.
meta
.
id
}
.title`
))
{
// Main title - Page title
title
=
`
${
title
}
-
${
this
.
$t
(
`
${
this
.
$route
.
meta
.
id
}
.title`
,
'
-t
'
)}
`
;
}
if
(
this
.
$te
(
`meta.
${
this
.
$route
.
meta
.
id
}
.title`
))
{
// Custom title
title
=
this
.
$t
(
`meta.
${
this
.
$route
.
meta
.
id
}
.title`
,
'
-t
'
);
/* Description */
const
description
=
this
.
$te
(
`meta.
${
this
.
$route
.
meta
.
id
}
.description`
)
?
this
.
$t
(
`meta.
${
this
.
$route
.
meta
.
id
}
.description`
)
:
this
.
$t
(
'
meta.description
'
,
'
-t
'
);
/* Preload */
const
preload
=
[];
/* array of { href: '', as: '' } */
const
nodes
=
10
;
/* link[rel="preload"] in index.html */
let
preloadList
=
[];
/* main and route files to preload */
const
mainList
=
this
.
$te
(
'
meta.preload
'
)
?
this
.
$t
(
'
meta.preload
'
)
:
[];
const
routeList
=
this
.
$te
(
`meta.
${
this
.
$route
.
meta
.
id
}
.preload`
)
?
this
.
$t
(
`meta.
${
this
.
$route
.
meta
.
id
}
.preload`
)
:
[];
/* merge main (in first) and route (in priority) list */
preloadList
=
mainList
.
slice
(
0
,
(
nodes
-
routeList
.
length
)).
concat
(
routeList
);
/* Fill with empty string */
while
(
preloadList
.
length
<
nodes
)
{
preloadList
.
push
(
''
);
}
for
(
let
i
=
0
;
i
<
preloadList
.
length
;
i
+=
1
)
{
let
type
=
''
;
if
(
/
\.(
png|jpg|gif|webp
)
$/
.
test
(
preloadList
[
i
]))
{
type
=
'
image
'
;
}
if
(
/
\.(
ttf|eot|woff|woff2
)
$/
.
test
(
preloadList
[
i
]))
{
type
=
'
font
'
;
}
if
(
/
\.(
webm|mp4
)
$/
.
test
(
preloadList
[
i
]))
{
type
=
'
video
'
;
}
preload
[
i
]
=
{
href
:
preloadList
[
i
].
replace
(
/^
\/
/
,
this
.
$t
(
'
baseurl
'
)),
as
:
type
,
};
}
return
{
...
...
@@ -68,6 +106,7 @@ export default {
appleicon
:
`
${
this
.
$t
(
'
baseurl
'
)}
img/icons/apple-touch-icon.png`
,
},
i18n
:
process
.
env
.
NODE_ENV
!==
'
prod
'
?
this
.
$i18n
.
messages
:
''
,
preload
,
};
},
...
...
app/components/partials/Header.vue
View file @
48e9b335
...
...
@@ -22,7 +22,7 @@
</
template
>
<
script
>
import
I18n
from
'
.
/I18n.vue
'
;
import
I18n
from
'
vue-fs-commons/app/components/partials
/I18n.vue
'
;
export
default
{
components
:
{
...
...
app/components/partials/I18n.vue
deleted
100644 → 0
View file @
f2e67009
<
template
>
<b-dd
id=
"f-i18n"
ref=
"f-i18n"
right
variant=
"outline-secondary"
:title=
"$t('nav.langChange', '-t')"
>
<template
v-slot:button-content
>
<svg-icon
name=
"language"
size=
"lg"
:label=
"$t('nav.lang', '-t')"
sr-only
/>
</
template
>
<li
v-for=
"lang in locales.visible"
:key=
"lang"
>
<b-link
:to=
"`/${lang}/${($route.path.split('/')[2] || '')}`"
class=
"dropdown-item"
@
click.native=
"changeLanguage(lang)"
v-text=
"locales[lang]"
/>
</li>
<b-dd-divider
v-if=
"$te('meta.i18n')"
/>
<li
v-if=
"$te('meta.i18n')"
>
<a
:href=
"$t('meta.i18n')"
class=
"dropdown-item"
>
<svg-icon
name=
"plus"
:label=
"$t('nav.translate')"
/>
</a>
</li>
</b-dd>
</template>
<
script
>
export
default
{
data
()
{
return
{
currentComponent
:
''
,
switchLanguage
:
'
en
'
,
locales
:
this
.
$i18n
.
messages
.
locales
,
};
},
methods
:
{
changeLanguage
(
lang
)
{
this
.
switchLanguage
=
lang
;
this
.
$i18n
.
locale
=
lang
;
[
this
.
currentComponent
]
=
[
this
.
$route
.
path
.
split
(
'
/
'
)[
2
]];
this
.
$refs
[
'
f-i18n
'
].
hide
(
true
);
},
},
};
</
script
>
app/data/project.tpl.yml
View file @
48e9b335
...
...
@@ -29,9 +29,15 @@ meta:
canonical
:
https://framasoft.org
description
:
Description is neededed for search engines, Twitter card and OpenGraph
# i18n: https://weblate.framasoft.org/projects/<project_name>
about
:
preload
:
-
/fonts/Roboto-Regular.woff2
-
/img/icons/apple-touch-icon.png
-
/img/icons/favicon.png
example
:
title
:
'
@:meta.title
-
@:about'
description
:
'
@:meta.lead'
preload
:
-
/img/opengraph/home.jpg
txt
:
# soft: text from color.soft (but you can reassign it here)
...
...
app/data/project.yml
View file @
48e9b335
...
...
@@ -14,7 +14,8 @@ meta:
canonical
:
https://framatalk.org/accueil/
description
:
'
@:meta.lead'
i18n
:
https://weblate.framasoft.org/projects/framatalk
preload
:
-
/fonts/Roboto-Regular.woff2
instances
:
framatalk
:
title
:
Framasoft
...
...
app/index.js
View file @
48e9b335
...
...
@@ -158,7 +158,8 @@ messages.locales.available.forEach((k) => {
// Create locale template to be able to use the English text
// instead of the yaml key for translation
if
(
k
===
'
en
'
)
{
// (disabled by default)
if
(
false
&&
k
===
'
en
'
)
{
Object
.
assign
(
messages
.
locales
.
map
,
...
function
_flatten
(
o
,
k
)
{
return
[].
concat
(...
Object
.
keys
(
o
)
...
...
index.html
View file @
48e9b335
...
...
@@ -22,6 +22,17 @@
<meta
name=
"twitter:description"
content=
""
>
<meta
name=
"twitter:title"
content=
""
>
<meta
name=
"twitter:image"
content=
""
>
<link
id=
"preload-0"
rel=
"preload"
href=
""
as=
""
>
<link
id=
"preload-1"
rel=
"preload"
href=
""
as=
""
>
<link
id=
"preload-2"
rel=
"preload"
href=
""
as=
""
>
<link
id=
"preload-3"
rel=
"preload"
href=
""
as=
""
>
<link
id=
"preload-4"
rel=
"preload"
href=
""
as=
""
>
<link
id=
"preload-5"
rel=
"preload"
href=
""
as=
""
>
<link
id=
"preload-6"
rel=
"preload"
href=
""
as=
""
>
<link
id=
"preload-7"
rel=
"preload"
href=
""
as=
""
>
<link
id=
"preload-8"
rel=
"preload"
href=
""
as=
""
>
<link
id=
"preload-9"
rel=
"preload"
href=
""
as=
""
>
</head>
<body>
<div
id=
"app"
></div>
...
...
package-lock.json
View file @
48e9b335
This diff is collapsed.
Click to expand it.
package.json
View file @
48e9b335
{
"name"
:
"vue-fs-template"
,
"description"
:
"Vue skeleton with i18n router"
,
"version"
:
"2
0.9
.1"
,
"version"
:
"2
1.1
.1
9
"
,
"author"
:
"JosephK"
,
"private"
:
true
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"commons"
:
"rm -rf node_modules/vue-fs-commons && npm i"
,
"sfs"
:
"./node_modules/vue-fs-commons/tools/copy-sfs-locales.sh"
,
"dev"
:
"rm -rf ./public && cross-env NODE_ENV=development webpack-dev-server --open false --hot --mode development"
,
"preview"
:
"rm -rf ./public && cross-env NODE_ENV=preview webpack --progress --hide-modules --mode production"
,
"prod"
:
"rm -rf ./public && cross-env NODE_ENV=production webpack --progress --hide-modules --mode production"
},
"dependencies"
:
{
"
@babel/plugin-transform-runtime
"
:
"
^7.9.0
"
,
"
bootstrap
"
:
"
^4.5.
2
"
,
"
bootstrap-vue
"
:
"
^2.
16.0
"
,
"
lodash
"
:
"
^4.17.
19
"
,
"
bootstrap
"
:
"
^4.5.
3
"
,
"
bootstrap-vue
"
:
"
^2.
21.1
"
,
"
lodash
"
:
"
^4.17.
20
"
,
"
marked
"
:
"
^0.7.0
"
,
"
roboto-fontface
"
:
"
^0.10.0
"
,
"
vue
"
:
"
^2.6.12
"
,
"vue-fs-commons"
:
"git+https://git@framagit.org/framasoft/vue-fs/commons.git"
,
"
vue-headful
"
:
"
^2.1.0
"
,
"
vue-i18n
"
:
"
^8.2
1.0
"
,
"
vue-router
"
:
"
^3.4.
3
"
"
vue-i18n
"
:
"
^8.2
2.2
"
,
"
vue-router
"
:
"
^3.4.
9
"
},
"devDependencies"
:
{
"
@babel/core
"
:
"
^7.1
0.5
"
,
"
@babel/plugin-proposal-object-rest-spread
"
:
"
^7.1
1.0
"
,
"
@babel/core
"
:
"
^7.1
2.10
"
,
"
@babel/plugin-proposal-object-rest-spread
"
:
"
^7.1
2.1
"
,
"
@babel/plugin-syntax-dynamic-import
"
:
"
^7.8.3
"
,
"
@babel/preset-env
"
:
"
^7.1
1.5
"
,
"
@babel/preset-env
"
:
"
^7.1
2.11
"
,
"
@prerenderer/renderer-jsdom
"
:
"
^0.2.0
"
,
"
autoprefixer
"
:
"
^9.8.
5
"
,
"
autoprefixer
"
:
"
^9.8.
6
"
,
"
babel-eslint
"
:
"
^10.1.0
"
,
"
babel-loader
"
:
"
^8.
1.0
"
,
"
babel-loader
"
:
"
^8.
2.2
"
,
"
copy-webpack-plugin
"
:
"
^5.1.2
"
,
"
cross-env
"
:
"
^5.2.1
"
,
"
css-hot-loader
"
:
"
^1.4.4
"
,
...
...
@@ -43,27 +44,26 @@
"
eslint-loader
"
:
"
^2.2.1
"
,
"
eslint-plugin-filenames
"
:
"
^1.3.2
"
,
"
eslint-plugin-html
"
:
"
^5.0.5
"
,
"
eslint-plugin-import
"
:
"
^2.22.
0
"
,
"
eslint-plugin-import
"
:
"
^2.22.
1
"
,
"
eslint-plugin-promise
"
:
"
^4.2.1
"
,
"
eslint-plugin-vue
"
:
"
^5.2.3
"
,
"
file-loader
"
:
"
^3.0.1
"
,
"
html-webpack-plugin
"
:
"
^4.
4.1
"
,
"
html-webpack-plugin
"
:
"
^4.
5.0
"
,
"
mini-css-extract-plugin
"
:
"
^0.6.0
"
,
"
node-sass
"
:
"
^4.14.1
"
,
"
optimize-css-assets-webpack-plugin
"
:
"
^5.0.4
"
,
"
postcss-loader
"
:
"
^3.0.0
"
,
"
preload-webpack-plugin
"
:
"
^3.0.0-beta.4
"
,
"
prerender-spa-plugin
"
:
"
^3.4.0
"
,
"
sass-loader
"
:
"
^7.3.1
"
,
"
style-loader
"
:
"
^0.23.1
"
,
"
svg-inline-loader
"
:
"
^0.8.2
"
,
"
terser-webpack-plugin
"
:
"
^1.4.5
"
,
"
vue-loader
"
:
"
^15.9.
3
"
,
"
vue-loader
"
:
"
^15.9.
6
"
,
"
vue-template-compiler
"
:
"
^2.6.12
"
,
"
webpack
"
:
"
^4.44.
1
"
,
"
webpack
"
:
"
^4.44.
2
"
,
"
webpack-cli
"
:
"
^3.3.12
"
,
"
webpack-dev-server
"
:
"
^3.11.
0
"
,
"
webpack-subresource-integrity
"
:
"
^1.
4.1
"
,
"
webpack-dev-server
"
:
"
^3.11.
1
"
,
"
webpack-subresource-integrity
"
:
"
^1.
5.2
"
,
"
yaml-import-loader
"
:
"
^1.3.6
"
}
}
webpack.config.js
View file @
48e9b335
...
...
@@ -12,7 +12,6 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const
TerserPlugin
=
require
(
'
terser-webpack-plugin
'
);
const
OptimizeCSSAssetsPlugin
=
require
(
'
optimize-css-assets-webpack-plugin
'
);
const
VueLoaderPlugin
=
require
(
'
vue-loader/lib/plugin
'
);
const
PreloadWebpackPlugin
=
require
(
'
preload-webpack-plugin
'
);
const
mode
=
{
dev
:
process
.
env
.
NODE_ENV
===
'
development
'
,
...
...
@@ -205,18 +204,6 @@ if (mode.dev) {
template
:
'
index.html
'
,
filename
:
path
.
resolve
(
__dirname
,
'
public/index.html
'
),
}),
new
PreloadWebpackPlugin
({
rel
:
'
preload
'
,
as
(
entry
)
{
if
(
/
\.
css$/
.
test
(
entry
))
return
'
style
'
;
if
(
/
\.
woff$/
.
test
(
entry
))
return
'
font
'
;
if
(
/
\.
png$/
.
test
(
entry
))
return
'
image
'
;
if
(
/
\.
jpg$/
.
test
(
entry
))
return
'
image
'
;
return
'
script
'
;
},
fileBlacklist
:
[
/
\.
map/
,
/
\.
svg/
,
/
\.
woff/
,
/
\.
eot/
,
/
\.
woff2/
,
/
\.
ttf/
,
/
\.
png/
,
/
\.
gif/
,
/
\.
mp4/
],
include
:
'
allAssets
'
,
}),
new
PrerenderSPAPlugin
({
staticDir
:
path
.
join
(
__dirname
,
'
public
'
),
routes
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment