Go for a more generic js bundling architecture

* Don't tie the output name to webpack itself
* Don't call js bundling webpack in python code
* Make the doc more generic about js bundling
This commit is contained in:
klmp200 authored and Bartuccio Antoine committed 2024-11-19 21:22:14 +01:00
1 parent 3db1f592e2
commit 7b41051d0d
56 files changed
+73 -73

No files matched your search

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -1,7 +1,7 @@
{% extends "core/base.jinja" %}
{% block additional_js %}
{% if settings.SENTRY_DSN %}
<script src="{{ static('webpack/sentry-popup-index.ts') }}" defer ></script>
<script src="{{ static('bundled/sentry-popup-index.ts') }}" defer ></script>
{% endif %}
{% endblock additional_js %}
+7 -7
View File
@@ -14,17 +14,17 @@
{% block jquery_css %}
{# Thile file is quite heavy (around 250kb), so declaring it in a block allows easy removal #}
<link rel="stylesheet" href="{{ static('webpack/jquery-index.css') }}">
<link rel="stylesheet" href="{{ static('bundled/jquery-index.css') }}">
{% endblock %}
<link rel="preload" as="style" href="{{ static('webpack/fontawesome-index.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ static('webpack/fontawesome-index.css') }}"></noscript>
<link rel="preload" as="style" href="{{ static('bundled/fontawesome-index.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ static('bundled/fontawesome-index.css') }}"></noscript>
<script src="{{ url('javascript-catalog') }}"></script>
<script src={{ static("webpack/core/components/include-index.ts") }}></script>
<script src="{{ static('webpack/alpine-index.js') }}" defer></script>
<script src="{{ static('webpack/htmx-index.js') }}" defer></script>
<script src={{ static("bundled/core/components/include-index.ts") }}></script>
<script src="{{ static('bundled/alpine-index.js') }}" defer></script>
<script src="{{ static('bundled/htmx-index.js') }}" defer></script>
<!-- Jquery declared here to be accessible in every django widgets -->
<script src="{{ static('webpack/jquery-index.js') }}"></script>
<script src="{{ static('bundled/jquery-index.js') }}"></script>
<!-- Put here to always have access to those functions on django widgets -->
<script src="{{ static('core/js/script.js') }}"></script>
@@ -7,7 +7,7 @@
{%- endblock -%}
{% block additional_js %}
<script src="{{ static("webpack/user/family-graph-index.js") }}" defer></script>
<script src="{{ static("bundled/user/family-graph-index.js") }}" defer></script>
{% endblock %}
{% block title %}
+1 -1
View File
@@ -5,7 +5,7 @@
{%- endblock -%}
{% block additional_js %}
<script src="{{ static('webpack/user/pictures-index.js') }}" defer></script>
<script src="{{ static('bundled/user/pictures-index.js') }}" defer></script>
{% endblock %}
{% block title %}
+1 -1
View File
@@ -76,7 +76,7 @@ class NFCTextInput(TextInput):
def get_context(self, name, value, attrs):
context = super().get_context(name, value, attrs)
context["statics"] = {
"js": staticfiles_storage.url("webpack/core/components/nfc-input-index.ts"),
"js": staticfiles_storage.url("bundled/core/components/nfc-input-index.ts"),
"css": staticfiles_storage.url("core/components/nfc-input.scss"),
}
return context
+2 -2
View File
@@ -9,7 +9,7 @@ class MarkdownInput(Textarea):
context = super().get_context(name, value, attrs)
context["statics"] = {
"js": staticfiles_storage.url("webpack/core/components/easymde-index.ts"),
"css": staticfiles_storage.url("webpack/core/components/easymde-index.css"),
"js": staticfiles_storage.url("bundled/core/components/easymde-index.ts"),
"css": staticfiles_storage.url("bundled/core/components/easymde-index.css"),
}
return context
+2 -2
View File
@@ -19,10 +19,10 @@ class AutoCompleteSelectMixin:
pk = "id"
js = [
"webpack/core/components/ajax-select-index.ts",
"bundled/core/components/ajax-select-index.ts",
]
css = [
"webpack/core/components/ajax-select-index.css",
"bundled/core/components/ajax-select-index.css",
"core/components/ajax-select.scss",
]