Swiftpack.co - Hejki/SassPublishPlugin as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Hejki.
Hejki/SassPublishPlugin 0.1.0
A Swift-Sass plugin for the Publish static site generator
⭐️ 15
🕓 4 years ago
.package(url: "https://github.com/Hejki/SassPublishPlugin.git", from: "0.1.0")

Sass plugin for Publish

A Publish plugin that makes it easy to integrate the Swift-Sass wrapper around LibSass C/C++ port of the Sass engine.

Installation

To use this repository you need to install the LibSass Library first. See this instructions for building/installing LibSass.

To install plugin into your Publish package, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        ...
        .package(url: "https://github.com/hejki/sasspublishplugin", from: "0.1.0")
    ],
    targets: [
        .target(
            ...
            dependencies: [
                ...
                "SassPublishPlugin"
            ]
        )
    ]
    ...
)

Then import SassPublishPlugin wherever you’d like to use it:

import SassPublishPlugin

For more information on how to use the Swift Package Manager, check out this article, or its official documentation.

Usage

The plugin can then be used within any publishing pipeline like this:

import SassPublishPlugin
...
try DeliciousRecipes().publish(using: [
    .installPlugin(
        .compileSass(
            sassFilePath: "Sources/sass/styles.sass", 
            cssFilePath: "styles.css"
        )
    )
    ...
])

You can use predefined compressed sass options for minimal result:

.compileSass(
    sassFilePath: "Sources/sass/styles.sass", 
    cssFilePath: "styles.css",
    compressed: true
)

Or yse can define sass options manually:

.compileSass(sassFilePath: "styles.sass", cssFilePath: "styles.css") { options in
    options.setOutputStyle(.compact)
    options.setSourceComments(true)
}

GitHub

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

Related Packages

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