0

我正在尝试提供一个 /manfest.json 文件 - 它有一些适用于 android 的图标信息。

  {
    "name": "woot.io",
    "icons": [
        {
            "src": "\/android-chrome-192x192.png",
            "sizes": "192x192",
            "type": "image\/png"
        },
        {
            "src": "\/android-chrome-512x512.png",
            "sizes": "512x512",
            "type": "image\/png"
        }
    ],
    "theme_color": "#0d87e9",
    "display": "standalone"
  }

当我将文件放入 /contents 时,Wintersmith 会将其呈现到 /manifest.html。不好。

在 /contents/manifest.json 中有这个:

{
  "template": "manifest.jade",
  "filename": "manifest.json"
}

使用模板,但我还没有找到让 Jade 输出 json 的语法。有没有更好的办法?我觉得我错过了一些更容易的东西。

4

2 回答 2

1

好的,我找到了解决方案:

内容/manifest.md

---
template: manifest.jade
filename: manifest.json
---

模板/manifest.jade

|{
|   "name": "woot.io",
|   "icons": [
|       {
|           "src": "\/android-chrome-192x192.png",
|           "sizes": "192x192",
|           "type": "image\/png"
|       },
|       {
|           "src": "\/android-chrome-512x512.png",
|           "sizes": "512x512",
|           "type": "image\/png"
|       }
|   ],
|   "theme_color": "#0d87e9",
|   "display": "standalone"
|}
于 2016-10-01T01:49:27.220 回答
1

还有一个wintersmith-asis插件可以让这更简单一些。只需安装插件,将其添加到您的插件配置中,然后重命名manifest.json_asis_.manifest.json

https://github.com/luckyrandom/wintersmith-asis

于 2016-11-20T16:53:22.887 回答