How can I use bootstrap with cloudflare apps

368 Views Asked by At

I have tried adding bootstrap css to the install.json file the following way, but I got an error:

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

How can I add it to the project and use it?

1

There are 1 best solutions below

2
On

I tested this in my install.json and it worked fine

 "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": {}
}

There is likely something wrong with the JSON of your install.json. You could try copy and paste your install.json in this tool to test: https://www.cloudflare.com/apps/developer/install-json-tester