Make the web shine. ✨

Related tags

Layout css html swift web spm
Overview

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.

Comments
  • SPARK-31 | Improve StyleSheetRenderer and CSS Generation

    SPARK-31 | Improve StyleSheetRenderer and CSS Generation

    Added

    • RuleContainer will now contain all of the rules before handing them off to the renderer for the rendering step. This has been done to improve compatibility with Publish and to support concurrency for future improvements.

    Improved

    • StyleSheetRenderer is now a struct and will only be instantiated during the CSS generation step.
    • Generator has been moved from Sparkle to SparkleTools

    Created via Raycast

    enhancement 
    opened by gaetanomatonti 1
  • SPARK-30 | Fix Crash when Inserting Multiple Rules

    SPARK-30 | Fix Crash when Inserting Multiple Rules

    Added

    • A new insert(_ rules:) method has been added to add multiple rules at once.

    Fixed

    • A crash that would occur when trying to insert rules by calling the insert(_ rule:) method multiple times, for example in a for loop.

    Created via Raycast

    bug 
    opened by gaetanomatonti 1
  • SPARK-28 | Add Measurement Values

    SPARK-28 | Add Measurement Values

    Added

    • The new protocol MeasurementValue is now available and groups all values representing measurements, such as pixels, ems and so on.
    • The clamp function is now available and is represented by the Clamp type.
    • The calc function is now available and is represented by the Calculation type.
    • The operators +, -, * and / have been extended to the MeasurementValue types. Using one of these operators will create the corresponding Calculation.
    • The LinearScale function is now available and allows scaling a value between a range of dimensions and viewport widths. This can be useful for linearly scaling the font size.
    • The IdentifiedValue type is now available and allows values to be identified by a name. This significantly improves the readability of the CSS stylesheet by replacing values in the classes with identifiers.

    Improved

    • The modifiers that used Unit values now use a generic MeasurementValue. This allows modifiers to take in a measurement or a function such as clamp or calc.
    • The Percentage type is now a MeasurementValue, allowing it to be used as a measurement for properties such as width.

    Removed

    • Unit has been removed in favour of the new types for the measurements that represent each measurement individually (EM, REM, Pixel, Viewport.Height, Viewport.Width, Zero, Auto).

    Created via Raycast

    enhancement 
    opened by gaetanomatonti 1
  • SPARK-22 | Improve Edge, Padding and Margin

    SPARK-22 | Improve Edge, Padding and Margin

    Improved

    • The Edge model now as a Set which convienently gives premade sets, such as all, horizontal and vertical
    • Both the padding and margin modifiers have been improved to support the new Edge.Set
    • The Edge and padding and margin modifier methods are now tested

    Created via Raycast

    enhancement 
    opened by gaetanomatonti 1
  • SPARK-20 | Add Colors and Gradients

    SPARK-20 | Add Colors and Gradients

    Added

    Thanks to colours and gradients, you can now make your website more colourful and stylish!

    • New objects that represent colours have been added:
      • RGB to create colours with RGB components.
      • HSL to create colours with HSL components.
      • NamedColor: an enumeration of colours available in the CSS library.
      • Hex to create colours from their hexadecimal representation.
    • As well as gradients:
      • Gradient.
      • LinearGradient.
    • Helper modifiers to apply styles have been added:
      • backgroundStyle(_ style:) applies a colour or gradient as the element's background.
      • foregroundStyle(_ style:) applies a colour or gradient as the element's foreground. Using this modifier automatically clips the background to achieve text with gradients! 🎉
      • Declarations that set the background-color, background-image and color CSS properties.

    Fixes

    • An issue with the escaping of characters in CSS selector names.
    enhancement 
    opened by gaetanomatonti 1
  • SPARK-19 | Add Font and Text Support

    SPARK-19 | Add Font and Text Support

    Added

    • New types that represent values for font-related properties:
      • Font.Family
      • Font.Stretch
      • Font.Style
      • Font.Variant
      • Font.Weight
      • Text.Alignment
      • Text.Decoration and Text.Decoration.Style
      • Text.Transform
    • Support for local fonts with Font.Face.

    Improvements

    • Import has been renamed into Source.
    • A new extension on Value to synthesize the conformance to the Renderable protocol for RawRepresentable types.
    enhancement 
    opened by gaetanomatonti 1
  • SPARK-25 | Refactor Declaration Type

    SPARK-25 | Refactor Declaration Type

    Removed

    • The Declaration initializer that allowed an array of values has been removed since it's not always possible to predict how these values should be rendered in CSS. Instead, use a wrapper value type to represent values such as margins on all edges with different values (margin: 8px 4px 2px 12px;).
    • Rules and declarations that allowed margins and padding to be set on different edges simultaneously.
    bug 
    opened by gaetanomatonti 1
  • SPARK-12 | Add File Rendering Indentation

    SPARK-12 | Add File Rendering Indentation

    Added

    • A new Indentation type has been added to customise rendered CSS and HTML indentation.
    • New HTMLRenderer and components renderer objects have been added to render HTML documents and components into strings.
    • New CSS renderer objects have been added to render the single components of the stylesheets.

    Improvements

    • Rules are now sorted! The new sorting algorithm is based on selector priorities (universal selector *, element, identifier and then class) and their contents.
    • The rendering of CSS Attributes has been moved to a new AttributeRenderer.
    enhancement 
    opened by gaetanomatonti 1
  • SPARK-24 | Add CSS @import Support

    SPARK-24 | Add CSS @import Support

    Added

    • Support for the CSS @import rule, which allows importing stylesheets or resources, such as fonts, in stylesheets. You can add Import objects to the StyleSheetRenderer.

    Improvements

    • The Renderer class has been renamed to StyleSheetRenderer.
    enhancement 
    opened by gaetanomatonti 1
  • SPARK-3 | Add CSS Flex and Layout Properties

    SPARK-3 | Add CSS Flex and Layout Properties

    Added

    • New CSS properties:
      • box-sizing
      • display
      • flex-direction
      • justify-content
      • align-content
      • align-items
      • padding
      • min-width
      • width
      • max-width
      • min-height
      • height
      • max-height
    • New viewport Unit:
      • vw
      • vh

    Improvements

    • The Rule type now supports selectors, meaning that rules selecting identifiers, elements and all elements in a document can now be created.
    • The Site type now provides a new method that allows configuration of the Renderer object, which allows additional rules to be inserted outside of the document. This is usually needed to create universal rules.

    Fixes

    • Fixed an issue with some classes that included the dot . character in their name. The rendering of Unit values that support floating point values now escapes any point contained in the rule's name.
    • Fixed an issue where the attributes would not be applied to a component that wraps an AttributedComponent.
    enhancement 
    opened by gaetanomatonti 1
  • SPARK-4 | Add HTML Components and Attributes

    SPARK-4 | Add HTML Components and Attributes

    Added

    • New HTML elements (a, article, aside, blockquote, body, div, footer, h1, h2, h3, h4, h5, h6, head, header, image, link, li, main, menu, meta, nav, ol, p, script, section, span, text, title, video).
    • New attributes (defer, height, identifier, rel, src, width).
    enhancement 
    opened by gaetanomatonti 1
Releases(0.3.1-alpha)
  • 0.3.1-alpha(Nov 13, 2022)

    Added

    • A new insert(_ rules:) method has been added to add multiple rules at once.

    Fixed

    • A crash that would occur when trying to insert rules by calling the insert(_ rule:) method multiple times, for example in a for loop.
    • Fixed builds failing on Linux environments.

    Removed

    • Syntax checking for Hex values has been removed.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0-alpha(Nov 13, 2022)

    Added

    • New types that represent values for font-related properties:
      • Font.Family
      • Font.Stretch
      • Font.Style
      • Font.Variant
      • Font.Weight
      • Text.Alignment
      • Text.Decoration and Text.Decoration.Style
      • Text.Transform
    • Support for local fonts with Font.Face.
    • New objects that represent colours have been added:
      • RGB to create colours with RGB components.
      • HSL to create colours with HSL components.
      • NamedColor: an enumeration of colours available in the CSS library.
      • Hex to create colours from their hexadecimal representation.
    • As well as gradients:
      • Gradient.
      • LinearGradient.
    • Helper modifiers to apply styles have been added:
      • backgroundStyle(_ style:) applies a colour or gradient as the element's background.
      • foregroundStyle(_ style:) applies a colour or gradient as the element's foreground. Using this modifier automatically clips the background to achieve text with gradients! 🎉
    • Declarations that set the background-color, background-image and color CSS properties.
    • Sparkle now supports border and border-radius styling.
    • The new protocol MeasurementValue is now available and groups all values representing measurements, such as pixels, ems and so on.
    • The clamp function is now available and is represented by the Clamp type.
    • The calc function is now available and is represented by the Calculation type.
    • The operators +, -, * and / have been extended to the MeasurementValue types. Using one of these operators will create the corresponding Calculation.
    • The LinearScale function is now available and allows scaling a value between a range of dimensions and viewport widths. This can be useful for linearly scaling the font size.
    • The IdentifiedValue type is now available and allows values to be identified by a name. This significantly improves the readability of the CSS stylesheet by replacing values in the classes with identifiers.

    Improved

    • Import has been renamed into Source.
    • A new extension on Value to synthesize the conformance to the Renderable protocol for RawRepresentable types.
    • The Edge model now has a Set which conveniently gives premade sets, such as all, horizontal and vertical
    • Both the padding and margin modifiers have been improved to support the new Edge.Set
    • The Edge and padding and margin modifier methods are now tested
    • New modifiers to apply borders on edges individually have been added.
    • The modifiers that used Unit values now use a generic MeasurementValue. This allows modifiers to take in a measurement or a function such as clamp or calc.
    • The Percentage type is now a MeasurementValue, allowing it to be used as a measurement for properties such as width.

    Removed

    • The Declaration initializer that allowed an array of values has been removed since it's not always possible to predict how these values should be rendered in CSS. Instead, use a wrapper value type to represent values such as margins on all edges with different values (margin: 8px 4px 2px 12px;).
    • Rules and declarations that allowed margins and padding to be set on different edges simultaneously.
    • Unit has been removed in favour of the new types for the measurements that represent each measurement individually (EM, REM, Pixel, Viewport.Height, Viewport.Width, Zero, Auto).

    Fixed

    • An issue with the escaping of characters in CSS selector names.
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0-alpha(Oct 20, 2022)

    Added

    • New HTML elements:
      • a
      • article
      • aside
      • blockquote
      • body
      • div
      • footer
      • h1
      • h2
      • h3
      • h4
      • h5
      • h6
      • head
      • header
      • image
      • link
      • li
      • main
      • menu
      • meta
      • nav
      • ol
      • p
      • script
      • section
      • span
      • text
      • title
      • ul
      • video
    • New attributes:
      • defer
      • height
      • identifier
      • rel
      • src
      • width
    • New CSS properties:
      • box-sizing
      • display
      • flex-direction
      • justify-content
      • align-content
      • align-items
      • padding
      • min-width
      • width
      • max-width
      • min-height
      • height
      • max-height
    • New viewport Unit:
      • vw
      • vh
    • Support for the CSS @import rule, which allows importing stylesheets or resources, such as fonts, in stylesheets. You can add Import objects to the StyleSheetRenderer.
    • A new Indentation type has been added to customise rendered CSS and HTML indentation.
    • New HTMLRenderer and components renderer objects have been added to render HTML documents and components into strings.
    • New CSS renderer objects have been added to render the single components of the stylesheets.

    Improvements

    • The Rule type now supports selectors, meaning that rules selecting identifiers, elements and all elements in a document can now be created.
    • The Site type now provides a new method that allows configuration of the Renderer object, which allows additional rules to be inserted outside of the document. This is usually needed to create universal rules.
    • The Renderer class has been renamed to StyleSheetRenderer.
    • Rules are now sorted! The new sorting algorithm is based on selector priorities (universal selector *, element, identifier and then class) and their contents.
    • The rendering of CSS Attributes has been moved to a new AttributeRenderer.

    Fixes

    • Fixed an issue with some classes that included the dot . character in their name. The rendering of Unit values that support floating point values now escapes any point contained in the rule's name.
    • Fixed an issue where the attributes would not be applied to a component that wraps an AttributedComponent.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0-alpha(Oct 15, 2022)

Owner
Gaetano Matonti
iOS Engineer @wise-emotions
Gaetano Matonti
This library allows you to make any UIView tap-able like a UIButton.

UIView-TapListnerCallback Example To run the example project, clone the repo, and run pod install from the Example directory first. Installation UIVie

wajeehulhassan 8 May 13, 2022
IOS-PokemonQuizApp - Assignment to make a responsive iOS app. App has to connect with an external API

iOS-PokemonQuizApp Assignment to make a responsive iOS app. App has to connect with an external API. The Project The idea of the project is to make a

BennyDB 0 Jan 9, 2022
LoadingButtton - Add button extendded from LoadingButton in the view and make it center horizontally

LoadingButtton Usage/Examples Add button extendded from LoadingButton in the vie

Alireza 1 Jan 8, 2022
A Swift utility to make updating table views/collection views trivially easy and reliable.

ArrayDiff An efficient Swift utility to compute the difference between two arrays. Get the removedIndexes and insertedIndexes and pass them directly a

Adlai Holler 100 Jun 5, 2022
Enables you to hide ur UIViews and make them screen/screen shot proof. objective c/c++ only

SecureView Enables you to hide ur UIViews and make them screen/screen shot proof. objective c/c++ only Usage UIWindow* mainWindow; - (void) setup {

Red16 6 Oct 13, 2022
Animated shine effect for your views

Shine-View-SwiftUI Animated shine effect for your views @State var animateTrigger = false var body: some View { Button(action: { animate

Алексей 9 Sep 14, 2022
This app is a sample app that recognizes specific voice commands such as "make it red", "make it blue", "make it green", and "make it black" and change the background color of the view in the frame.

VoiceOperationSample This app is a sample app that recognizes specific voice commands such as "make it red", "make it blue", "make it green", and "mak

Takuya Aso 3 Dec 3, 2021
EVURLCache - a NSURLCache subclass for handling all web requests that use NSURLRequest

EVURLCache What is this? This is a NSURLCache subclass for handeling all web requests that use NSURLRequest. (This includes UIWebView) The EVURLCache

Edwin Vermeer 296 Dec 18, 2022
Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web

Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web. It provides you a chance to use a pure-Swift way to work

Wei Wang 20.9k Dec 30, 2022
Robust Swift networking for web APIs

Conduit Conduit is a session-based Swift HTTP networking and auth library. Within each session, requests are sent through a serial pipeline before bei

Mindbody 52 Oct 26, 2022
Super lightweight web framework in Swift based on SWSGI

Ambassador Super lightweight web framework in Swift based on SWSGI Features Super lightweight Easy to use, designed for UI automatic testing API mocki

Envoy 170 Nov 15, 2022
A Swift web framework and HTTP server.

A Swift Web Framework and HTTP Server Summary Kitura is a web framework and web server that is created for web services written in Swift. For more inf

Kitura 7.6k Dec 27, 2022
A Swift Multiplatform Single-threaded Non-blocking Web and Networking Framework

Serverside non-blocking IO in Swift Ask questions in our Slack channel! Lightning (formerly Edge) Node Lightning is an HTTP Server and TCP Client/Serv

SkyLab 316 Oct 6, 2022
💧 A server-side Swift web framework.

Vapor is a web framework for Swift. It provides a beautifully expressive and easy to use foundation for your next website, API, or cloud project. Take

Vapor 22.4k Jan 7, 2023
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.

Why Zewo? • Support • Community • Contributing Zewo Zewo is a lightweight library for web applications in Swift. What sets Zewo apart? Zewo is not a w

Zewo 1.9k Dec 22, 2022
Beautiful flag icons for usage in apps and on the web.

FlagKit Beautiful flag icons for usage in apps and on the web. All flags are provided as stand-alone PNG and SVG files. FlagKit also provides an Asset

Bowtie 2.9k Dec 29, 2022
SwiftWebUI - A demo implementation of SwiftUI for the Web

SwiftWebUI More details can be found on the related blog post at the Always Right Institute. At WWDC 2019 Apple announced SwiftUI. A single "cross pla

SwiftWebUI 3.8k Dec 28, 2022
Stock is a MacOS menu bar app that helps you quickly save a web link, a file link, or a text by using drag and drop

Stock is a MacOS menu bar app that helps you quickly save a web link, a file link, or a text by using drag and drop

シュンジョーァ 19 Dec 4, 2022
Demo of a simple ASP.NET Core web API written in Swift

Welcome! This repo is a demo which shows the use of Llama Swift with ASP.NET Core. Llama is my exploratory project to compile "other languages" for .N

Eric Sink 14 Mar 2, 2022
An extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memory and disk caching for iOS and  Watch.

KFSwiftImageLoader KFSwiftImageLoader is an extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memor

Kiavash Faisali 343 Oct 29, 2022