用于 nuxt.js 构建的自定义 index.html [英] Custom index.html for nuxt.js build

查看:342
本文介绍了用于 nuxt.js 构建的自定义 index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉,如果有人问这个,只是不确定要搜索什么.在 spa 模式下构建 Nuxt 应用 时,是否可以更改用于生成 index.html 文件的模板?

Sorry if this is asked, just not sure what to search for. Is there a way to change the template that's used to generate the index.html file when building a Nuxt app in spa mode?

推荐答案

要覆盖.nuxt/views/app.template.html,需要创建app.htmlcode> 项目根目录下的文件.然后,您可以从 app.template.html 复制粘贴一般内容并开始修改内容.

For overwriting the .nuxt/views/app.template.html, you need to create app.html file at the root of the project. You can then, copy-paste the general content from app.template.html and start modifying things.

例如 - 我必须将 lang 属性添加到 html 标签,所以我在我的 应用程序中稍微更新了代码.html

For eg - I have to add the lang attribute to the html tag, so I have updated the code a bit in my app.html

app.html

<!DOCTYPE html>
<html lang="en" {{ HTML_ATTRS }}>
  <head {{ HEAD_ATTRS }}>
    {{ HEAD }}
  </head>
  <body {{ BODY_ATTRS }}>
    {{ APP }}
  </body>
</html>

这篇关于用于 nuxt.js 构建的自定义 index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆