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

Relative paths for assets in vite dev mode #30

Open
hazelybell opened this issue Nov 21, 2023 · 1 comment
Open

Relative paths for assets in vite dev mode #30

hazelybell opened this issue Nov 21, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@hazelybell
Copy link

I'm using nunjucks.

Writing something in src/pages/whatever.njk such as

<img src="../images/cat.jpg">

works in build mode, but it doesn't work in dev mode (npm run).

<img src="/src/images/cat.jpg">

Works in both modes, but I'm migrating from webpack so I don't really want to go through and fix a million src= attributes. It also kinda makes more sense to me to use relative paths here.

I'm not sure if there's something to turn on to fix it, but i tried normalizeBasePath. I'm new to this, so please excuse me if there's something I'm missing.

@lubomirblazekcz
Copy link
Member

Seems to be limitation of https://github.com/vituum/vituum/blob/main/src/plugins/pages.js#L34, but right now I can't think of a easy fix for this. So I recommend rewrite the paths to absolute as the only fix right now.

@lubomirblazekcz lubomirblazekcz added the bug Something isn't working label Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants