Hacker News new | ask | show | jobs
by delhanty 3146 days ago
Evaluating Vue and React at the moment:

From the Vue documentation [1]:

>Even if you don’t like the idea of Single-File Components, you can still leverage its hot-reloading and pre-compilation features by separating your JavaScript and CSS into separate files:

  <!-- my-component.vue -->
  <template>
    <div>This will be pre-compiled</div>
    </template>
  <script src="./my-component.js"></script>
  <style src="./my-component.css"></style>
If I end up going with Vue, I'd probably do that. It looks like a lot of boilerplate though ...

Is there any tool from the Node ecosystem designed to reduce that boilerplate?

Thanks for any insights!

[1] https://vuejs.org/v2/guide/single-file-components.html#What-...

1 comments

I started off hating the idea of single page components; I'd have much rather had a component reside within a directory (with template.html, style.sass and script.es6.js files or whatever) but in reality, so long as you keep your templates light and do any heavy lifting elsewhere, it's quite manageable.

Newer JavaScript functionality makes that work nicely.

Almost all of my components fit on one screen.