vue生成静态html文件_webpack – 是否可以将Vue.js模板编译为静态HTML和CSS文件?

您正在寻找的是服务器端渲染.我建议你看看Nuxt.js.

Properly configuring all the discussed aspects of a production-ready

server-rendered app can be a daunting task. Luckily, there is an

excellent community project that aims to make all of this easier:

Nuxt.js. Nuxt.js is a higher-level framework built on top of the Vue

ecosystem which provides an extremely streamlined development

experience for writing universal Vue applications. Better yet, you can

even use it as a static site generator (with pages authored as

single-file Vue components)! We highly recommend giving it a try.

得到它是非常简单的started.如果你使用vue-cli:

$vue init nuxt/starter

它配备了您通常需要的所有功能(Vuex,Router,..).请记住,它强制执行一些您必须遵循的文件夹结构.

Here是启动器中包含的命令列表.

"scripts": {

"dev": "nuxt",

"build": "nuxt build",

"start": "nuxt start",

"generate": "nuxt generate"

}

你可能会主要对generate进行迭代

Build the application and generate every route as a HTML file (used

for static hosting).

同样值得注意的是该项目似乎是(在撰写本文时)under active development,我们可以期待更多出色的功能!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值