Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's my least favourite thing about Vue. One directory per component makes so much more sense to me, not having a mix of syntaxes in a single file.

Still, Vue is my favourite tech for SPAs.



I really love single file components. We are extending the syntax more by also adding <specification> and <requirements> tags to single file components. Great for automatically generating documentation and keeping it in the same place as the components. Was a bit afraid that the compiler would protest, but so far so good.


Where do you put the elements? Next to the <template> or inside it?


Next to it, so that it doesn't interfere with either <style>, <script> or <template>.


Vue does allow you to split css, js and html to separate files by using src attribute in sfc file.

Ref: https://vuejs.org/v2/guide/single-file-components.html#What-...


Vue (like with most of its features) let's you do that if you want. The <script> and <style> tags in the .vue file can reference other files so you can have a directory per component with separate code files. Sometimes that's helpful for better code completion and formatting too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: