Swiftpack.co - gaetanomatonti/Sparkle as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by gaetanomatonti.
gaetanomatonti/Sparkle 0.4.0-alpha
Make the web shine. ✨
⭐️ 4
🕓 1 year ago
macOS
.package(url: "https://github.com/gaetanomatonti/Sparkle.git", from: "0.4.0-alpha")

Sparkle

Make the web shine. ✨

Note that the software provided in this package is still in early development, and APIs are subject to changes.

Static Site Generation

Sparkle takes advantage of SSG (Static Site Generation) to generate static websites with a DSL powered by Swift. Static websites are generated at build time and immediately rendered on the client side, shortening the browser's load times.

Creating a Website

To create a website using Sparkle, create a Swift Package in Xcode, then add Sparkle as a dependency in your Package.swift.

dependencies: [
  .package(url: "https://github.com/gaetanomatonti/Sparkle.git", branch: "main")
],

Create an executable target that depends on Sparkle.

targets: [
  .executableTarget(
    name: "MyWebsite",
    dependencies: [
      .product(name: "Sparkle", package: "Sparkle")
    ]
  )
]

Create main.swift in your target's Source folder. This is the main entry point of your target. Here you can prompt the generation of your website.

struct MyWebsite: Site {
  var homepage: Page {
    Home()
  }
}

try MyWebsite().generate()

As a result of the generation, files will be created under your package's Output directory.

Hooray! You've created your very first website with Sparkle.

GitHub

link
Stars: 4
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1 year ago

Improvements

  • Generator has been renamed to FileGenerator.

Fixes

  • Resolved an issue where the renderer would render an empty stylesheet. This happened because the rules' handoff step was missing in the generation method.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics