Is it possible to compile Vue.js templates to static HTML and CSS files?

后端 未结 4 911
时光取名叫无心
时光取名叫无心 2021-02-05 06:33

Recently I\'ve fallen in love with Vue.js\'s single file components. It\'s so much nicer to have a component\'s template and styles close to each other, and I\'m finding I write

4条回答
  •  春和景丽
    2021-02-05 07:11

    I would say that you can't do this because Vue uses a virtual DOM, it doesn't compile templates to HTML but to JavaScript render functions which is necessary to efficiently patch the DOM when data is updated.

    I'm sure it's possible to do what you want to do with a bit of node magic to parse and output files, but that would be quite a large undertaking for something that would only have a minimal effect.

提交回复
热议问题