{"id":18818048,"url":"https://github.com/pointfreeco/swift-html-vapor","last_synced_at":"2025-04-13T12:03:46.551Z","repository":{"id":43002274,"uuid":"147423081","full_name":"pointfreeco/swift-html-vapor","owner":"pointfreeco","description":"💧 Vapor plugin for type-safe, transformable HTML views.","archived":false,"fork":false,"pushed_at":"2024-07-04T01:05:17.000Z","size":36,"stargazers_count":89,"open_issues_count":3,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-06T19:03:07.046Z","etag":null,"topics":["dsl","html","server-side-swift","swift","vapor"],"latest_commit_sha":null,"homepage":"https://www.pointfree.co/blog/posts/17-type-safe-html-with-vapor","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pointfreeco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-04T21:40:00.000Z","updated_at":"2024-12-17T14:54:37.000Z","dependencies_parsed_at":"2024-11-24T19:04:46.573Z","dependency_job_id":"88bf4a1a-0c4d-4b97-827b-a80a45e75aaf","html_url":"https://github.com/pointfreeco/swift-html-vapor","commit_stats":{"total_commits":11,"total_committers":4,"mean_commits":2.75,"dds":0.4545454545454546,"last_synced_commit":"a0f52527267fa5c26d8ac21e09b84c3a4d23c1a3"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointfreeco%2Fswift-html-vapor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointfreeco%2Fswift-html-vapor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointfreeco%2Fswift-html-vapor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointfreeco%2Fswift-html-vapor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pointfreeco","download_url":"https://codeload.github.com/pointfreeco/swift-html-vapor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232786434,"owners_count":18576419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsl","html","server-side-swift","swift","vapor"],"created_at":"2024-11-08T00:14:42.526Z","updated_at":"2025-01-06T21:13:26.148Z","avatar_url":"https://github.com/pointfreeco.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swift-html-vapor\n\n[![CI](https://github.com/pointfreeco/swift-html-vapor/actions/workflows/ci.yml/badge.svg)](https://github.com/pointfreeco/swift-html-vapor/actions/workflows/ci.yml)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fpointfreeco%2Fswift-html-vapor%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/pointfreeco/swift-html-vapor)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fpointfreeco%2Fswift-html-vapor%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/pointfreeco/swift-html-vapor)\n\n[Vapor](https://vapor.codes) plugin for type-safe, transformable HTML views using [swift-html](https://github.com/pointfreeco/swift-html).\n\n## Motivation\n\nThe most popular choice for rendering HTML in a Vapor web app is to use the Leaf templating language, but it exposes your application to **runtime errors** and **invalid HTML**. Our plugin prevents these runtime issues at compile-time by embedding HTML directly into Swift’s powerful type system. It uses the [swift-html](https://github.com/pointfreeco/swift-html) DSL for constructing HTML documents using plain Swift data structures.\n\n## Usage\n\nTo use the plugin all you have to do is return a `Node` value from your router callback:\n\n``` swift\nimport HtmlVaporSupport\nimport Vapor\n\nvar env = try Environment.detect()\nlet app = Application(env)\ndefer { app.shutdown() }\n\napp.get { _ in\n  Node.h1(\"Hello, type-safe HTML on Vapor!\")\n}\n\ntry app.run()\n```\n\n## Take it for a spin\n\nWe've included a sample Vapor application in this repo to show off its usage. To run the app immediately, simply do:\n\n* `swift run HtmlVaporSupportExample`\n* Open your browser to `http://localhost:8080`\n\nThe HTML for that page is constructed and rendered with swift-html!\n\nIf you want to run the app in Xcode so that you can play around with the HTML, try this:\n\n* `git clone https://github.com/pointfreeco/swift-html-vapor`\n* `cd swift-html-vapor`\n* `make xcodeproj`\n* Select the `HtmlVaporSupportExample` target\n* Build and run `cmd+R`\n* Open your browser to `http://localhost:8080`\n\n## Installation\n\nIf you want to use swift-html-vapor in a project that uses [SwiftPM](https://swift.org/package-manager/), it's as simple as adding a `dependencies` clause to your `Package.swift`:\n\n``` swift\ndependencies: [\n  .package(url: \"https://github.com/pointfreeco/swift-html-vapor\", from: \"0.4.0\")\n]\n```\n\n## License\n\nAll modules are released under the MIT license. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpointfreeco%2Fswift-html-vapor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpointfreeco%2Fswift-html-vapor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpointfreeco%2Fswift-html-vapor/lists"}