1
0
forked from test/crm

refactor: moved boot variable loading code in vite

This commit is contained in:
Shariq Ansari 2024-06-03 19:04:15 +05:30
parent 8cb0b9aec0
commit 10c65f3d6c
2 changed files with 22 additions and 10 deletions

View File

@ -177,14 +177,6 @@
</head>
<body class="sm:overscroll-y-none no-scrollbar">
<div id="app" class="h-full"></div>
<div id="modals"></div>
<div id="popovers"></div>
<script>
{% for key in boot %}
window["{{ key }}"] = {{ boot[key] | tojson }};
{% endfor %}
</script>
<script type="module" src="/src/main.js"></script>
</body>
</html>

View File

@ -24,8 +24,9 @@ export default defineConfig({
display: 'standalone',
name: 'Frappe CRM',
short_name: 'Frappe CRM',
start_url: "/crm",
description: 'Modern & 100% Open-source CRM tool to supercharge your sales operations',
start_url: '/crm',
description:
'Modern & 100% Open-source CRM tool to supercharge your sales operations',
icons: [
{
src: '/assets/crm/manifest/manifest-icon-192.maskable.png',
@ -54,6 +55,25 @@ export default defineConfig({
],
},
}),
{
name: 'transform-index.html',
transformIndexHtml(html, context) {
if (!context.server) {
return html.replace(
/<\/body>/,
`
<script>
{% for key in boot %}
window["{{ key }}"] = {{ boot[key] | tojson }};
{% endfor %}
</script>
</body>
`
)
}
return html
},
},
],
resolve: {
alias: {