diff options
author | silverwind <me@silverwind.io> | 2020-01-28 22:57:20 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2020-01-28 23:57:20 +0200 |
commit | b9690d7c0b4980c46b3416e36478fa0140dd5f9e (patch) | |
tree | 9395508c79655a7807f98de4d0a4fd75267f6a76 /templates | |
parent | d879353632c5220c8ac0e3831311ebfe7cf357fe (diff) | |
download | gitea-b9690d7c0b4980c46b3416e36478fa0140dd5f9e.tar.gz gitea-b9690d7c0b4980c46b3416e36478fa0140dd5f9e.zip |
move highlight.js to npm/webpack (#10011)
- introduced window.config to help with js-based lazy-loading
- adjusted webpack chunk naming to avoid 'vendors~name.js' that webpack
defaults to for vendor chunks.
- added theme class to html and prefixed all selectors. this is
neccesary so that the theme styles win over the lazy-loaded ones.
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/base/footer.tmpl | 3 | ||||
-rw-r--r-- | templates/base/head.tmpl | 15 | ||||
-rw-r--r-- | templates/pwa/serviceworker_js.tmpl | 4 |
3 files changed, 13 insertions, 9 deletions
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl index f59b34a983..db196c41a1 100644 --- a/templates/base/footer.tmpl +++ b/templates/base/footer.tmpl @@ -24,9 +24,6 @@ {{end}} <!-- Third-party libraries --> -{{if .RequireHighlightJS}} - <script src="{{StaticUrlPrefix}}/vendor/plugins/highlight/highlight.pack.js"></script> -{{end}} {{if .RequireMinicolors}} <script src="{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.min.js"></script> {{end}} diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 0e7fc3c534..496e2e67af 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -83,6 +83,17 @@ for the JavaScript code in this page. */`}} </script> + <script> + window.config = { + Datetimepicker: {{if .RequireDatetimepicker}}true{{else}}false{{end}}, + Dropzone: {{if .RequireDropzone}}true{{else}}false{{end}}, + HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}}, + Minicolors: {{if .RequireMinicolors}}true{{else}}false{{end}}, + SimpleMDE: {{if .RequireSimpleMDE}}true{{else}}false{{end}}, + Tribute: {{if .RequireTribute}}true{{else}}false{{end}}, + U2F: {{if .RequireU2F}}true{{else}}false{{end}}, + }; + </script> <link rel="shortcut icon" href="{{StaticUrlPrefix}}/img/favicon.png"> <link rel="apple-touch-icon" href="{{StaticUrlPrefix}}/img/favicon.png"> <link rel="mask-icon" href="{{StaticUrlPrefix}}/img/gitea-safari.svg" color="#609926"> @@ -106,10 +117,6 @@ .ui.secondary.menu .dropdown.item > .menu { margin-top: 0; } </style> </noscript> - -{{if .RequireHighlightJS}} - <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/highlight/github.css"> -{{end}} {{if .RequireMinicolors}} <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.css"> {{end}} diff --git a/templates/pwa/serviceworker_js.tmpl b/templates/pwa/serviceworker_js.tmpl index d89713eb16..a81731a5dc 100644 --- a/templates/pwa/serviceworker_js.tmpl +++ b/templates/pwa/serviceworker_js.tmpl @@ -3,6 +3,7 @@ var urlsToCache = [ // js '{{StaticUrlPrefix}}/fomantic/semantic.min.js?v={{MD5 AppVer}}', '{{StaticUrlPrefix}}/js/gitgraph.js', + '{{StaticUrlPrefix}}/js/highlight.js', '{{StaticUrlPrefix}}/js/index.js?v={{MD5 AppVer}}', '{{StaticUrlPrefix}}/js/jquery.js?v={{MD5 AppVer}}', '{{StaticUrlPrefix}}/js/swagger.js?v={{MD5 AppVer}}', @@ -11,7 +12,6 @@ var urlsToCache = [ '{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/meta.js', '{{StaticUrlPrefix}}/vendor/plugins/dropzone/dropzone.js', '{{StaticUrlPrefix}}/vendor/plugins/emojify/emojify.custom.js', - '{{StaticUrlPrefix}}/vendor/plugins/highlight/highlight.pack.js', '{{StaticUrlPrefix}}/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js', '{{StaticUrlPrefix}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.js', '{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.min.js', @@ -20,13 +20,13 @@ var urlsToCache = [ // css '{{StaticUrlPrefix}}/css/gitgraph.css', + '{{StaticUrlPrefix}}/css/highlight.css', '{{StaticUrlPrefix}}/css/index.css?v={{MD5 AppVer}}', '{{StaticUrlPrefix}}/css/swagger.css?v={{MD5 AppVer}}', '{{StaticUrlPrefix}}/fomantic/semantic.min.css?v={{MD5 AppVer}}', '{{StaticUrlPrefix}}/vendor/assets/font-awesome/css/font-awesome.min.css', '{{StaticUrlPrefix}}/vendor/assets/octicons/octicons.min.css', '{{StaticUrlPrefix}}/vendor/plugins/dropzone/dropzone.css', - '{{StaticUrlPrefix}}/vendor/plugins/highlight/github.css', '{{StaticUrlPrefix}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.css', '{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.css', '{{StaticUrlPrefix}}/vendor/plugins/simplemde/simplemde.min.css', |