How does this work #167
-
I saw that it uses a tagged template literals tag function |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Hi, I'm glad to hear that you're interested in how Vine works, but the issue area is for reporting bugs or requirements, not for asking questions. I'll turn this issue into a discussion and then answer your questions. |
Beta Was this translation helpful? Give feedback.
-
If you have read the documentation of Vue Vine, you'll know that Vine has a compiler to extract the tagged template string from the So If the implementation is all inside the If you have more questions, free to talk with us here. |
Beta Was this translation helpful? Give feedback.
-
So the |
Beta Was this translation helpful? Give feedback.
Yes, there's no actual implementation of this "function
vine
".The basic mentality here is to "borrow a form in valid syntax, and handle its AST representation, transform to what you want".
That's a mechanism we called "Macros", it only runs at compile time, and may totally change what you saw in source code.
If you really want to know how this compilation magic works, you can check
src/analyze.ts
,template/compose.ts
, andsrc/transform.ts
underpackages/compiler
.