Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vite.root = ./src #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ npm run build
npm run preview
```

> [!NOTE]
> At this point everything is working as expected.
> [!CAUTION]
> At this point only `dev` is working, `build` ends with error:

![](docs/vite-build-error.png)
Binary file added docs/vite-build-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/pages/handlebars.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Vituum Handlebars</title>
<link rel="stylesheet" href="/src/styles/main.css">
<link rel="stylesheet" href="/styles/main.css">
</head>
<body>

<div id="wrapper">
<h1>Vituum Handlebars</h1>
<img class="logo" src="/src/assets/logo.svg" alt="Vituum">
<img class="logo" src="/assets/logo.svg" alt="Vituum">
{{> "partials/nav.hbs" }}
<p id="js">JS not working :(</p>
</div>

<script type="module" src="/src/scripts/main.js"></script>
<script type="module" src="/scripts/main.js"></script>

</body>
</html>
6 changes: 3 additions & 3 deletions src/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Vituum Simple HTML</title>
<link rel="stylesheet" href="/src/styles/main.css">
<link rel="stylesheet" href="/styles/main.css">
</head>
<body>

<div id="wrapper">
<h1>Vituum Simple HTML</h1>
<img class="logo" src="/src/assets/logo.svg" alt="Vituum">
<img class="logo" src="/assets/logo.svg" alt="Vituum">
<ul class="nav">
<li><a href="/">Home</a></li>
<li><a href="/handlebars">Handlebars</a></li>
</ul>
<p id="js">JS not working :(</p>
</div>

<script type="module" src="/src/scripts/main.js"></script>
<script type="module" src="/scripts/main.js"></script>

</body>
</html>
14 changes: 11 additions & 3 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ import { defineConfig } from 'vite';
import vituum from 'vituum';

export default defineConfig(() => ({
root: './src',
build: {
outDir: '../dist',
emptyOutDir: true,
},
plugins: [
vituum(),
handlebars({
root: './src',
vituum({
pages: {
root: '.', // relative to vite.root
dir: 'pages' // relative to vite.root
},
}),
handlebars(),
],
}));