/SassPublishPlugin

A Swift-Sass plugin for the Publish static site generator

Primary LanguageSwiftMIT LicenseMIT

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)
}