refactor(js): streamline frontend SCSS import

Migrated the SCSS import for the frontend directly into editor.js and
userarea.js from frontend.js, removing redundancy by consolidating style
imports. This adjustment enables more coherent management of SCSS files
and removes the need for a separate frontend bundle. Consequently,
frontend.js and its references in HTML templates were removed to clean
up the codebase and simplify the asset pipeline. These changes should
make future maintenance of CSS easier and improve load times by reducing
unnecessary scripting and network requests.
This commit is contained in:
Kumi 2024-03-15 15:06:15 +01:00
parent 0888e6132a
commit bcca11aab9
Signed by: kumi
GPG key ID: ECBCC9082395383F
6 changed files with 9 additions and 9 deletions

View file

@ -1,6 +1,7 @@
import { getScene, getSceneElement, getCategory } from "./api";
import { populateDestinationDropdown } from "./editor/teleport";
import "../scss/frontend.scss";
import "../css/editor.css";
let clickTimestamp = 0;
@ -94,6 +95,9 @@ function startModifyElement(event) {
<hr/>
<form id="modifyElementForm">
<input type="hidden" id="csrfmiddlewaretoken" value="${getCookie(
"csrftoken"
)}">
<input type="hidden" id="id" value="${event.target.getAttribute("id")}">
<div class="dropdown mb-2">
<label for="destinationDropdownSearch" class="form-label">Teleport Destination</label>
@ -149,7 +153,10 @@ function startModifyElement(event) {
reader.onload = function (e) {
// Set the image to the file contents
if (event.target.getAttribute("data-original-src") == undefined) {
event.target.setAttribute("data-original-src", event.target.getAttribute("src"));
event.target.setAttribute(
"data-original-src",
event.target.getAttribute("src")
);
}
event.target.setAttribute("src", e.target.result);
};

View file

@ -1 +0,0 @@
import '../scss/frontend.scss';

View file

@ -1,3 +1,4 @@
import '../scss/frontend.scss';
import '../css/userarea.css';
import { Tab } from 'bootstrap';

View file

@ -3,11 +3,6 @@
<html>
<head>
<title>{{ scene.title }} Quackscape</title>
<script
type="text/javascript"
type="module"
src="{% static 'js/frontend.bundle.js' %}"
></script>
<script
type="text/javascript"
type="module"

View file

@ -29,7 +29,6 @@
</div>
</div>
<script src="{% static 'js/frontend.bundle.js' %}"></script>
<script src="{% static 'js/userarea.bundle.js' %}"></script>
</body>
</html>

View file

@ -9,7 +9,6 @@ module.exports = {
scene: "./assets/js/scene.js",
editor: "./assets/js/editor.js",
userarea: "./assets/js/userarea.js",
frontend: "./assets/js/frontend.js",
},
output: {
path: path.resolve(__dirname, "static/js"),