aboutsummaryrefslogtreecommitdiff
path: root/viewer/vue.config.js
diff options
context:
space:
mode:
authorZéro~Informatique2022-07-26 08:44:34 +0200
committerpacien2022-09-03 01:30:42 +0200
commit00510820a2794efcadbc83f7f8b54318fe198ecb (patch)
treea894d99c22a601197869c7a6928d40bb4ae2c392 /viewer/vue.config.js
parent88aa098c07e067f9f737fbeba1f52a9bd5042e53 (diff)
downloadldgallery-00510820a2794efcadbc83f7f8b54318fe198ecb.tar.gz
viewer: migrate to vue 3, general refactoring and cleanup
Non-exhaustive list of fixes and improvements done at the same time: - html default background to grey (avoids white flash during init) - unified links behavior - added more theme variables - removed the flex-expand transition (it wasn't working) and replaced it with a slide - fixed LdLoading not centered on the content - title on removable tags - fixed an issue with encoded URI from vue-router - unified Item resource URLs - removed the iframe for PlainTextViewer (it wasn't working properly) and replaced it with a pre - fixed clear and search buttons tabindex - fixed the information panel bumping up during the fade animation of tag's dropdown - fixed some focus outlines not appearing correctly - moved CSS variables to the :root context - Code cleaning GitHub: closes #217 GitHub: closes #300 GitHub: closes #297 GitHub: closes #105 GitHub: closes #267 GitHub: closes #275 GitHub: closes #228 GitHub: closes #215 GitHub: closes #112
Diffstat (limited to 'viewer/vue.config.js')
-rw-r--r--viewer/vue.config.js70
1 files changed, 29 insertions, 41 deletions
diff --git a/viewer/vue.config.js b/viewer/vue.config.js
index 8649b6d..e49909f 100644
--- a/viewer/vue.config.js
+++ b/viewer/vue.config.js
@@ -1,7 +1,7 @@
1/* ldgallery - A static generator which turns a collection of tagged 1/* ldgallery - A static generator which turns a collection of tagged
2-- pictures into a searchable web gallery. 2-- pictures into a searchable web gallery.
3-- 3--
4-- Copyright (C) 2019-2020 Guillaume FOUET 4-- Copyright (C) 2019-2022 Guillaume FOUET
5-- 5--
6-- This program is free software: you can redistribute it and/or modify 6-- This program is free software: you can redistribute it and/or modify
7-- it under the terms of the GNU Affero General Public License as 7-- it under the terms of the GNU Affero General Public License as
@@ -22,49 +22,37 @@
22-- VUE_APP_DEVSERVER_CONFIG_PATH=<http_url> will use the dev_proxyconfig 22-- VUE_APP_DEVSERVER_CONFIG_PATH=<http_url> will use the dev_proxyconfig
23-- VUE_APP_DEVSERVER_CONFIG_PATH=<fs_path> will use the dev_fsconfig 23-- VUE_APP_DEVSERVER_CONFIG_PATH=<fs_path> will use the dev_fsconfig
24*/ 24*/
25const dev_ready = Boolean(process.env.VUE_APP_DEVSERVER_CONFIG_PATH);
26const dev_isproxy = dev_ready && Boolean(process.env.VUE_APP_DEVSERVER_CONFIG_PATH.match(/^https?:\/\//i));
27const dev_localpath = `^/${process.env.VUE_APP_DATA_URL}`;
28const dev_proxyconfig = {
29 [dev_localpath]: {
30 target: process.env.VUE_APP_DEVSERVER_CONFIG_PATH,
31 pathRewrite: { [dev_localpath]: "" },
32 },
33};
34const dev_fsconfig = (app, server, compiler) => {
35 app.get(`${dev_localpath}*`, (req, res) => {
36 const fs = require("fs");
37 const url = req.url.slice(process.env.VUE_APP_DATA_URL.length);
38 const paramIdx = url.indexOf("?");
39 const filepath = paramIdx < 0 ? url : url.substring(0, paramIdx);
40 const fullpath = `${process.env.VUE_APP_DEVSERVER_CONFIG_PATH}${decodeURIComponent(filepath)}`;
41 const file = fs.readFileSync(fullpath);
42 res.end(file);
43 });
44};
45// =================
46 25
47module.exports = { 26const { defineConfig } = require('@vue/cli-service');
48 publicPath: "./", 27const devServer = require('./src/plugins/devServer');
28
29module.exports = defineConfig({
30 publicPath: './',
31 transpileDependencies: false,
32 productionSourceMap: false,
33
34 devServer,
49 pluginOptions: { 35 pluginOptions: {
50 i18n: {
51 locale: "en",
52 fallbackLocale: "en",
53 localeDir: "locales",
54 enableInSFC: false,
55 },
56 },
57 chainWebpack: config => {
58 config.plugins.delete("prefetch");
59 }, 36 },
37
60 configureWebpack: { 38 configureWebpack: {
61 devtool: "source-map", 39 cache: {
40 type: 'filesystem',
41 },
62 }, 42 },
63 productionSourceMap: false, 43
64 devServer: { 44 chainWebpack: config => {
65 port: process.env.VUE_APP_DEVSERVER_PORT, 45 // Integrates the YAML loader, for i18n files
66 serveIndex: true, 46 config.module
67 proxy: dev_ready && dev_isproxy ? dev_proxyconfig : undefined, 47 .rule('yaml')
68 before: dev_ready && !dev_isproxy ? dev_fsconfig : undefined, 48 .test(/\.ya?ml$/)
49 .use('yaml')
50 .loader('js-yaml-loader');
51 config.plugin('define')
52 .tap(args => {
53 args[0].__VUE_I18N_FULL_INSTALL__ = false;
54 args[0].__VUE_I18N_LEGACY_API__ = false;
55 return args;
56 });
69 }, 57 },
70}; 58});