-
Notifications
You must be signed in to change notification settings - Fork 150
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
Untraceable error using stylus and pug #447
Comments
Curiously enough, changing the index page into using only pug by taking out the |
Disclaimer: I don't know much about pug. Your code contains multiple syntax errors. This code works: <template lang="pug">
svelte:head: title Todos
.todos
h1 Todos
form.new(
action="/todos.json"
method="post"
'use:enhance'!=`{{
result: async (res, form) => {
const created = await res.json()
todos = [...todos, created]
form.reset()
}
}}`
)
input(
name="text"
'aria-label'="Add todo"
placeholder="+ tap to add a todo"
)
+each('todos as todo (todo.uid)')
.todo(
'class:done'!='{todo.done}'
'transition:scale|local'!='{{ start: 0.7 }}'
'animate:flip'!='{{ duration: 200 }}'
)
form(
action!="/todos/{todo.uid}.json?_method=patch"
method="post"
'use:enhance'!=`{{
pending: (data) => {
todo.done = !!data.get('done')
},
result: patch,
}}`
)
input(type="hidden" name="done" value!='{todo.done ? "" : "true"}')
button.toggle(
'aria-label'!="Mark todo as {todo.done ? 'not done' : 'done'}")
form.text(
action!="/todos/{todo.uid}.json?_method=patch"
method="post"
'use:enhance'!=`{{
result: patch
}}`
)
input('aria-label'="Edit todo" type="text" name="text" value!='{todo.text}')
button.save('aria-label'="Save todo")
form(
action!="/todos/{todo.uid}.json?_method=delete"
method="post"
'use:enhance'!=`{{
pending: () => (todo.pending_delete = true),
result: () => {
todos = todos.filter((t) => t.uid !== todo.uid)
}
}}`
)
button.delete('aria-label'="Delete todo" disabled!='{todo.pending_delete}')
</template> You forgot an extra That said, the error message is really suboptimal, it doesn't contain any context. So I will do the following:
|
Closes sveltejs#447 Also add note about a pug limitation using template literals
Closes #447 Also add note about a pug limitation using template literals
Describe the bug
I'm trying to convert the default SvelteKit demo project to use stylus and pug and get an untraceable error. I may very well be missing something stupid in my translation to stylus and/or pug, but the error being untraceable seems reason enough to report it here; that being said if I'm just doing something stupid and you can spot it I'd love to hear about it.
Logs
All I'm getting is:
To Reproduce
Clone my example repo demonstrating this issue, run
pnpm dev
and navigate to/todos
.Expected behavior
For my repo to be equivalent to the demo repo.
Information about your project:
I'm running Ubuntu 21.10 Impish, using Vivaldi (which runs on Chromium). My user agent is
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.113 Safari/537.36'
I'm using a freshly-installed
svelte-preprocess@4.10.1
; and whichever build system SvelteKit uses, which I'm pretty sure is just Vite.The text was updated successfully, but these errors were encountered: