Swift Package Index


A LibSass wrapper for Swift


  • The latest stable release is 0.3.0. Released 4 months ago.
  • The last commit to master was 2 months ago.

Swift Version Compatibility

  • 0.3.0 and master
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 0.3.0 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

SwiftySass

A LibSass wrapper for Swift. SwiftySass allows you to compile Sass code from Swift.

As of October 2020, LibSass is deprecated. I am unsure what that currently means for the future of this project. For the time being, I am not planning on continuing work on SwiftySass.

Installation

First, you need to have LibSass installed on your system. SwifySass expects the installation to be located at /usr/local/include/. Using Homebrew is suggested:

brew install libsass

SwiftySass can be installed using Swift Package Manager. To use SwiftySass in a project, add it to the dependencies section in your project’s Package.swift:

.package(url: "https://github.com/r-thomson/SwiftySass", from: "0.3.0")

Usage

import SwiftySass

// Compile from a string...
let scss = """
$primary-color: #222;
body {
  color: $primary-color;
}
"""
var css = try? compileSass(fromSource: scss)

// ...or from a file
let fileURL = URL(fileURLWithPath: "./style.scss")
css = try? compileSass(fromFile: fileURL)