title: Is it possible to compile Vue.js templates to static HTML and CSS files?
body: <p>Recently I've fallen in love with Vue.js's <a href="https://v2.vuejs.org/v2/guide/single-file-components.html" rel="nofollow noreferrer">single file components</a>. It's so much nicer to have a component's template and styles close to each other, and I'm finding I write a lot fewer bugs now that it's so easy to componentise part of a page and use it in multiple places.</p>
  <p>I'm wondering if I could extend this single-file component structure to generating static HTML pages, with no Vue involved.</p>
  <p>For example, say I want to have a page that has a main &quot;content&quot; div containing a header, a section, and a footer. Using Vue.js, I can create 'header', 'section', and 'footer' components, and use JavaScript to have them instantiated after the page loads. Because each part of the page is in its own component, there's no chance of CSS in one component affecting another, and I have a much cleaner tree of files to edit.</p>
  <p>However, this seems a little wasteful, as these components aren't actually interactive: I'm not using <code>v-model</code> or <code>v-bind</code> or <code>v-on</code>, I'm just using Vue.js because it lets me separate pieces of pages out. It also means my page won't work at all if JavaScript is disabled, since every single element (save the main content div) is dependent on Vue being available.</p>
  <p>So is there any way I can compile .vue files, not to a page that loads these components at runtime using Vue.js, but to separate HTML and CSS files that render without any JavaScript?</p>
  <p>Ideally, I'd have a component 'greeting.vue':</p>
  <pre><code>&lt;template&gt;
      &lt;p class=&quot;greeting&quot;&gt;Hello!&lt;/p&gt;
  &lt;/template&gt;
  &lt;style scoped&gt;
      .greeting { color: red; }
  &lt;/style&gt;
  </code></pre>
  <p>Used within a page:</p>
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;greeting&gt;&lt;/greeting&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>And these would compile into two files: an HTML page with the template compiled and pre-rendered, and a CSS file that contains the styles for all the components. I could then include the generated stylesheet in the page, and all the components would be styled.</p>
  <p>I've looked at <a href="https://github.com/vuejs/vue-loader" rel="nofollow noreferrer">vue-loader</a> and <a href="https://github.com/vuejs/vueify" rel="nofollow noreferrer">vueify</a>, but I can't understand what they're doing since I haven't used Webpack or Browserify enough.</p>
  <p>Is what I'm trying to do possible?</p>