After learning the basics of Bootstrap and choosing icons from the Font Awesome library, you can start putting everything together to upgrade the feel and look of web pages rendered by the Leaf templating engine.
To use Bootstrap in your Vapor project, you're required to use the file server middleware. Simply uncomment the following line in configure.swift:
middlewares.use(FileMiddleware.self) // Serves files from `Public/` directory
- The file server will make all the resource in /Public available for HTTP requests.
- Create two subdirectories, /css and /img, under /Public.
- Copy custom.css and pier.png from the resources for this chapter to /Public/css and /Public/img, respectively.
- The CSS stylesheet will be included in header.leaf:
<link rel="stylesheet" href="/css/custom.css">
Remember the path for Vapor...