Skip to content

[docs] simplify template literals to string primitives #6806

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

Merged
merged 4 commits into from
Dec 6, 2021

Conversation

dleicht
Copy link
Contributor

@dleicht dleicht commented Oct 4, 2021

Coming from python JS template literal syntax was new to me. This part of the otherwise fantastic tutorial threw me off, because I did not immediately notice the backticks. Like: "Oh, that's an interesting concept. But it doesn't work. Bummer."
Took me a while to figure.

Coming from python JS template literal syntax was new to me. This part of the otherwise fantastic tutorial threw me off, because I did not immediately notice the backticks. Like: "Oh, that's an interesting concept. But it doesn't work. Bummer."
Took me a while to figure.
@Conduitry
Copy link
Member

I don't know where the line is here about which JS features to explain in the docs. That could really easily get out of hand. If we do want to mention something here, I think it should be shorter and consist pretty much of just a link to MDN.

@bluwy
Copy link
Member

bluwy commented Oct 11, 2021

I'm not entirely sure if we need this either, but I've heard on Discord before about this issue too. Perhaps we can do + 'count' instead? Since the next chapter that uses backticks is Chapter 6 and the syntax there is noticeably deliberate as nested quotes are used.

@dleicht
Copy link
Contributor Author

dleicht commented Oct 11, 2021

I'm not entirely sure if we need this either, but I've heard on Discord before about this issue too. Perhaps we can do + 'count' instead? Since the next chapter that uses backticks is Chapter 6 and the syntax there is noticeably deliberate as nested quotes are used.

Reading this gave me the impression that you guys wanted the tutorial to be as easy and comprehensible as possible. If you decide to keep the backticks, then a tiny hint at that position would be really helpful imho :)

@bluwy
Copy link
Member

bluwy commented Oct 12, 2021

That's true and it still is. But we would still need to draw the line between teaching Svelte and teaching JS. Nonetheless, I would approve this if we refactor the code as + count instead, and remove the backticks. Others might have an opinion on this.

@benmccann benmccann changed the title [docs]A note about template literals [docs] add a note about template literals Oct 22, 2021
@benmccann
Copy link
Member

the next chapter that uses backticks is Chapter 6 and the syntax there is noticeably deliberate as nested quotes are used.

I'm not quite sure which one you're referring to. This was the first one I saw in chapter 6, but there doesn't seem to be nested quotes: https://svelte.dev/tutorial/group-inputs

@bluwy
Copy link
Member

bluwy commented Oct 22, 2021

I'm not quite sure which one you're referring to. This was the first one I saw in chapter 6, but there doesn't seem to be nested quotes: https://svelte.dev/tutorial/group-inputs

Yeah in that tutorial, on line 7 there's the usage of single quotes in the template literals, which I think makes it more obvious (maybe that's just me). But the usage of those inline JS expressions should make it obvious too.

@benmccann
Copy link
Member

I prefer @bluwy's + 'count' change rather than adding an explanation about template literals. It's far more concise

@bluwy
Copy link
Member

bluwy commented Dec 6, 2021

I've updated to use all single quotes instead.

@ignatiusmb ignatiusmb changed the title [docs] add a note about template literals [docs] simplify template literals to string primitives Dec 6, 2021
@ignatiusmb ignatiusmb merged commit 67f79dd into sveltejs:master Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants