Skip to content

Commit

Permalink
Migrate from Webpack to ViteJS
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanaellio committed Nov 6, 2023
1 parent 0ab5c82 commit c5fd120
Show file tree
Hide file tree
Showing 14 changed files with 986 additions and 8,879 deletions.
3 changes: 0 additions & 3 deletions apps/core/templates/core/create_dynamic_playlist.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% extends "core/navigation.html" %}
{% load static %}
{% load render_bundle from webpack_loader %}

{% block css %}
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/vue-multiselect.min.css">
Expand All @@ -14,8 +13,6 @@ <h5>{{ title }}</h5>
{% csrf_token %}
<create-dynamic-playlist></create-dynamic-playlist>
</div>

{% render_bundle 'app' %}
{% endblock %}

{% block javascript %}
Expand Down
3 changes: 0 additions & 3 deletions apps/core/templates/core/groups.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% extends "core/navigation.html" %}
{% load static %}
{% load render_bundle from webpack_loader %}

{% block css %}
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/vue-multiselect.min.css">
Expand All @@ -14,8 +13,6 @@ <h5>{{ title }}</h5>
{% csrf_token %}
<groups></groups>
</div>

{% render_bundle 'app' %}
{% endblock %}

{% block javascript %}
Expand Down
3 changes: 3 additions & 0 deletions apps/core/templates/core/navigation.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load static %}
{% load django_vite %}

<!DOCTYPE html>
<html lang="en">
Expand All @@ -14,6 +15,8 @@
<link rel="stylesheet" href="{% static 'css/main.css' %}">
{% block css %}{% endblock %}
<title>{{ title | default:"Melting Potlist" }}</title>
{% vite_hmr_client %}
{% vite_asset 'src/main.js' %}
</head>
<body>

Expand Down
3 changes: 0 additions & 3 deletions apps/core/templates/core/play_dynamic_playlist.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% extends "core/navigation.html" %}
{% load static %}
{% load render_bundle from webpack_loader %}

{% block css %}
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/vue-multiselect.min.css">
Expand All @@ -19,8 +18,6 @@ <h5>{{ title }}</h5>
<play-dynamic-playlist-listener></play-dynamic-playlist-listener>
{% endif %}
</div>

{% render_bundle 'app' %}
{% endblock %}

{% block javascript %}
Expand Down
6 changes: 4 additions & 2 deletions melting_potlist/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"django_yamlconf",
"rest_framework",
"widget_tweaks",
"webpack_loader",
"django_vite",
"django_user_agents",
"apps.core",
"apps.discord_login",
Expand Down Expand Up @@ -155,9 +155,11 @@

STATIC_URL = "/content/"

DJANGO_VITE_ASSETS_PATH = BASE_DIR / "vue_components" / "dist"

STATICFILES_DIRS = [
BASE_DIR / "static",
BASE_DIR / "vue_components" / "dist", # Static resources compiled by vue service build (using Webpack)
DJANGO_VITE_ASSETS_PATH,
]

STATIC_ROOT = BASE_DIR / "staticfiles"
Expand Down
18 changes: 12 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ whitenoise = "^6.3.0"
yt-dlp = "^2023.2.17"
google-api-python-client = "^2.79.0"
django-user-agents = "^0.4.0"
django-webpack-loader = "^1.8.1"
django-vite = "^2.1.3"
django-widget-tweaks = "^1.4.12"
uvicorn = "^0.20.0"
channels = "~3.0.5"
Expand Down
4 changes: 4 additions & 0 deletions vue_components/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
env: {
node: true,
es2022: true,
}
5 changes: 0 additions & 5 deletions vue_components/babel.config.js

This file was deleted.

24 changes: 9 additions & 15 deletions vue_components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src"
},
"dependencies": {
"@vue/cli-plugin-babel": "~4.5.15",
"@vue/cli-plugin-eslint": "~4.5.15",
"@vue/cli-service": "~4.5.15",
"@vue/compiler-sfc": "^3.3.7",
"babel-eslint": "^10.1.0",
"core-js": "^3.33.2",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^7.20.0",
"@vitejs/plugin-vue": "^4.4.0",
"django-vite-plugin": "^2.0.4",
"eslint": "^8.53.0",
"eslint-plugin-vue": "^9.18.1",
"pnpm": "^8.10.2",
"regenerator-runtime": "^0.13.9",
"vite": "^4.5.0",
"vue": "^3.3.7",
"vue-multiselect": "3.0.0-beta.3",
"webpack-bundle-tracker": "^1.4.0"
Expand All @@ -34,9 +31,6 @@
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
Expand Down
Loading

0 comments on commit c5fd120

Please sign in to comment.