mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
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>
This commit is contained in:
committed by
Lunny Xiao
co-authored by
techknowlogick
parent
89f7dcb13d
commit
5b17bb8f3d
@@ -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(/\/[^/]*?\/[^/]*?$/, '/');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user