First things first: to make use of most of the things here, you will need to fork the original Publish repository by John Sundell. If that sounds daunting, suspect or otherwise just plain too much work, you can always, say, go look at Hugo or Gatsby, both very fine, dandy & webby tools.
Otherwise, buckle up, there is some fun to be had!
Merge pull request & follow instructions.
As of November 2021, it looks like you will need to roll your own.
As a prerequisite, you apparently need to ensure Xcode command line tools are installed. If not, download and install a version matching your Xcode, or:
xcode-select --install
Installing LibSass via Homebrew:
brew install libsass
Next, include the Publish plugin for Sass in package.swift:
let package = Package(
…
dependencies: [
…
.package(url: "https://github.com/hejki/sasspublishplugin", from: "0.1.0"),
…
],
targets: [
.executableTarget(
…
dependencies: [
.product(name: "SassPublishPlugin", package: "sasspublishplugin"),
…
Note: building your website in Xcode must find the sass.h
header file, which will be under
/usr/local/Cellar/libsass/3.6.5/include
(Intel)/opt/homebrew/Cellar/libsass/3.6.5/include
. (ARM64)At this point, if you get a build error about sass.h
, you may need to restart Xcode.
In Package.swift
:
let package = Package(
…
dependencies: [
…
.package(
url: "https://github.com/nerdsupremacist/syntax-highlight-publish-plugin.git",
from: "0.1.0"
)
],
targets: [
.executableTarget(
…
dependencies: [
…
.product(
name: "SyntaxHighlightPublishPlugin",
package: "syntax-highlight-publish-plugin"
)
],
exclude: [
…
],
resources: [
.copy("Grammars/CSS.plist"),
.copy("Grammars/JavaScript.plist")
]
)
]
)
CSS test:
body {
background-color: #fff;
color: black;
}