diff --git a/src/djinit/templates/config/settings/base.py-tpl b/src/djinit/templates/config/settings/base.py-tpl index 2230e57..a880022 100644 --- a/src/djinit/templates/config/settings/base.py-tpl +++ b/src/djinit/templates/config/settings/base.py-tpl @@ -28,7 +28,7 @@ THIRD_PARTY_APPS = [ "drf_spectacular", "django_tailwind_cli", # @IF use_tailwind "django_htmx", # @IF use_htmx - "django_vite", # @IF use_vite + "django_vite", # @IF use_vite | use_vue ] USER_DEFINED_APPS = [ @@ -227,7 +227,7 @@ TAILWIND_CLI_CONFIG = { } # @ENDIF -# @IF use_vite +# @IF use_vite | use_vue # for django-vite DJANGO_VITE_ASSET_SRC = "frontend" DJANGO_VITE_DEV_SERVER_URL = "http://localhost:5173" diff --git a/src/djinit/templates/project/frontend/index-vue.html-tpl b/src/djinit/templates/project/frontend/index-vue.html-tpl new file mode 100644 index 0000000..6bcd7ab --- /dev/null +++ b/src/djinit/templates/project/frontend/index-vue.html-tpl @@ -0,0 +1,12 @@ + + + + + + [[ project_name ]] + + +
+ + + \ No newline at end of file diff --git a/src/djinit/templates/project/frontend/src/App.vue-tpl b/src/djinit/templates/project/frontend/src/App.vue-tpl new file mode 100644 index 0000000..7274a60 --- /dev/null +++ b/src/djinit/templates/project/frontend/src/App.vue-tpl @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/src/djinit/templates/project/frontend/src/main.js-tpl b/src/djinit/templates/project/frontend/src/main.js-tpl new file mode 100644 index 0000000..38f34ad --- /dev/null +++ b/src/djinit/templates/project/frontend/src/main.js-tpl @@ -0,0 +1,5 @@ +import { createApp } from 'vue' +import App from './App.vue' +import './style.css' + +createApp(App).mount('#app') \ No newline at end of file diff --git a/src/djinit/templates/project/frontend/src/style.css-tpl b/src/djinit/templates/project/frontend/src/style.css-tpl new file mode 100644 index 0000000..dc59d3c --- /dev/null +++ b/src/djinit/templates/project/frontend/src/style.css-tpl @@ -0,0 +1,14 @@ +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + line-height: 1.5; +} + +#app { + min-height: 100vh; +} \ No newline at end of file diff --git a/src/djinit/templates/project/package-vue.json-tpl b/src/djinit/templates/project/package-vue.json-tpl new file mode 100644 index 0000000..1136ceb --- /dev/null +++ b/src/djinit/templates/project/package-vue.json-tpl @@ -0,0 +1,22 @@ +#--------------------------------------------------# +# The following was generated by djinit: # +#--------------------------------------------------# + +{ + "name": "[[ project_name ]]-frontend", + "version": "0.0.1", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "vue": "^3.5.13" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^5.2.3", + "vite": "^6.3.5" + } +} \ No newline at end of file diff --git a/src/djinit/templates/project/requirements-tpl b/src/djinit/templates/project/requirements-tpl index bad8209..f654baf 100644 --- a/src/djinit/templates/project/requirements-tpl +++ b/src/djinit/templates/project/requirements-tpl @@ -13,6 +13,7 @@ whitenoise django-tailwind-cli # @IF use_tailwind django-htmx # @IF use_htmx django-vite # @IF use_vite +django-vite # @IF use_vue pytest # @IF use_pytest pytest-django # @IF use_pytest pytest-cov # @IF use_pytest diff --git a/src/djinit/templates/project/vite-vue.config.js-tpl b/src/djinit/templates/project/vite-vue.config.js-tpl new file mode 100644 index 0000000..c742be3 --- /dev/null +++ b/src/djinit/templates/project/vite-vue.config.js-tpl @@ -0,0 +1,25 @@ +#--------------------------------------------------# +# The following was generated by djinit: # +#--------------------------------------------------# + +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import path from 'path' + +export default defineConfig({ + plugins: [vue()], + root: 'frontend', + build: { + outDir: '../static/dist', + emptyOutDir: true, + }, + resolve: { + alias: { + '@': path.resolve(__dirname, 'frontend/src'), + }, + }, + server: { + port: 5173, + strictPort: true, + }, +}) \ No newline at end of file