【问题标题】:How to use an environment variable in Sapper's template.html?如何在 Sapper 的 template.html 中使用环境变量?
【发布时间】:2021-02-25 22:56:52
【问题描述】:

我想在template.html 中使用环境变量,以便我可以根据运行应用程序的位置更改所有页面的头部内容。这可能吗?

【问题讨论】:

    标签: environment-variables sapper


    【解决方案1】:

    我从未找到将环境变量放入template.html 的方法,但我通过server.js 传递了我需要的内容,在_layout.svelte 中获取它,并将其包含在<svelte:head> 元素中。

    【讨论】:

      猜你喜欢
      • 2021-06-18
      • 1970-01-01
      • 1970-01-01
      • 2014-10-05
      • 2021-11-17
      • 2016-04-11
      • 2014-01-01
      • 2014-12-01
      • 1970-01-01
      相关资源
      最近更新 更多