summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-01-25 09:41:34 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2020-01-25 16:41:34 +0800
commit5b17bb8f3dbc180c72446000d82ba06fd7349dc7 (patch)
treef75eda7a6b1094a239769e8c4d7b9bbc010d1f07 /web_src
parent89f7dcb13d8cc8be9615004a2ce5a476c14bc8e6 (diff)
downloadgitea-5b17bb8f3dbc180c72446000d82ba06fd7349dc7.tar.gz
gitea-5b17bb8f3dbc180c72446000d82ba06fd7349dc7.zip
add css extraction and minification to webpack (#9944)
This changes the CSS output of webpack to output to the public/css directory instead of inling CSS in JS. This enables CSS minification and autoprefixer based on browserslist which would otherwise not be possible. The result of this change is two new output files currently: - public/css/swagger.css - public/css/gitgraph.css Co-authored-by: techknowlogick <matti@mdranta.net>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/publicPath.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/web_src/js/publicPath.js b/web_src/js/publicPath.js
index 5d277e442a..120740d708 100644
--- a/web_src/js/publicPath.js
+++ b/web_src/js/publicPath.js
@@ -1,12 +1,11 @@
-/* This sets up webpack's chunk loading to load resources from the same
- directory where it loaded index.js from. This file must be imported
- before any lazy-loading is being attempted. */
+/* This sets up webpack's chunk loading to load resources from the 'public'
+ directory. This file must be imported before any lazy-loading is being attempted. */
if (document.currentScript && document.currentScript.src) {
const url = new URL(document.currentScript.src);
- __webpack_public_path__ = `${url.pathname.replace(/\/[^/]*$/, '')}/`;
+ __webpack_public_path__ = url.pathname.replace(/\/[^/]*?\/[^/]*?$/, '/');
} else {
// compat: IE11
const script = document.querySelector('script[src*="/index.js"]');
- __webpack_public_path__ = `${script.getAttribute('src').replace(/\/[^/]*$/, '')}/`;
+ __webpack_public_path__ = script.getAttribute('src').replace(/\/[^/]*?\/[^/]*?$/, '/');
}