如何在cloudflare应用程序中使用bootstrap

时间:2018-06-13 21:29:43

标签: cloudflare-apps

我尝试过以下方式将bootstrap css添加到install.json文件中,但是我收到了一个错误:

,
      {
        "type": "style",
        "src": "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
      }

如何将其添加到项目中并使用它?

1 个答案:

答案 0 :(得分:0)

我在install.json中对其进行了测试,并且效果很好

 "resources": {
    "body": [
      {
        "type": "style",
        "src": "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
      },
      {
        "type": "style",
        "src": "./source/app.css"
      },
      {
        "type": "script",
        "src": "./source/app.js"
      }
    ]
  },

  "preview": {
    "handlers": [
      {
        "options": ["_default"],
        "execute": "INSTALL_SCOPE.setOptions(INSTALL_OPTIONS)"
      },
      {
        "options": ["_product"],
        "execute": "INSTALL_SCOPE.setProduct(INSTALL_PRODUCT)"
      }
    ]
  },
  "options": {}
}

install.json的JSON可能有问题。您可以尝试将install.json复制并粘贴到此工具中进行测试:https://www.cloudflare.com/apps/developer/install-json-tester