Swiftpack.co -  SDGGiesbrecht/SDGWeb as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
SDGGiesbrecht/SDGWeb
Tools for Generating Websites
.package(url: "https://github.com/SDGGiesbrecht/SDGWeb.git", from: "5.5.3")

macOS • Windows • Web • CentOS • Ubuntu • tvOS • iOS • Android • Amazon Linux • watchOS

Documentation

SDGWeb

SDGWeb provides tools for generating websites.

כְּשִׁמְךָ אֱלֹהִים כְּן תְּהלָּתְךָ עַל־קַצְוֵי־אֶרֶץ׃

Like your name, O God, your praise reaches to the ends of the earth.

―sons of קורח/Koraẖ

Features:

  • Sites are constructed from simple templates.
  • Customizable template processing in Swift.
  • Supports localized websites.

Example Usage

let mock = RepositoryStructure(
  root:
    sdgWebRepositoryRoot
    .appendingPathComponent("Tests")
    .appendingPathComponent("Mock Projects")
    .appendingPathComponent(mockName)
)

let site = Site<L, Unfolder>(
  repositoryStructure: mock,
  siteRoot: UserFacing<URL, L>({ _ in return URL(string: "http://example.com")! }),
  localizationDirectories: UserFacing<StrictString, L>({ localization in
    return localization.icon ?? StrictString(localization.code)
  }),
  author: UserFacing<ElementSyntax, L>({ _ in
    return .author("John Doe", language: InterfaceLocalization.englishCanada)
  }),
  reportProgress: { _ in }
)

try site.generate().get()
let warnings = site.validate()

Some platforms lack certain features. The compilation conditions which appear throughout the documentation are defined as follows:

.define("PLATFORM_LACKS_FOUNDATION_FILE_MANAGER", .when(platforms: [.wasi])),

Importing

SDGWeb provides libraries for use with the Swift Package Manager.

Simply add SDGWeb as a dependency in Package.swift and specify which of the libraries to use:

let package = Package(
  name: "MyPackage",
  dependencies: [
    .package(
      name: "SDGWeb",
      url: "https://github.com/SDGGiesbrecht/SDGWeb",
      from: Version(5, 5, 3)
    ),
  ],
  targets: [
    .target(
      name: "MyTarget",
      dependencies: [
        .product(name: "SDGWeb", package: "SDGWeb"),
        .product(name: "SDGHTML", package: "SDGWeb"),
        .product(name: "SDGCSS", package: "SDGWeb"),
      ]
    )
  ]
)

The modules can then be imported in source files:

import SDGWeb
import SDGHTML
import SDGCSS

About

The SDGWeb project is maintained by Jeremy David Giesbrecht.

If SDGWeb saves you money, consider giving some of it as a donation.

If SDGWeb saves you time, consider devoting some of it to contributing back to the project.

Ἄξιος γὰρ ὁ ἐργάτης τοῦ μισθοῦ αὐτοῦ ἐστι.

For the worker is worthy of his wages.

―‎ישוע/Yeshuʼa

GitHub

link
Stars: 1
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

Version 5.5.3
1 week ago

Bug Fixes

  • Requires Swift 5.4 (but older toolchains will not resolve to this version).

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