Skip to content

Instantly share code, notes, and snippets.

@bsrz
Last active May 9, 2023 03:35
Show Gist options
  • Select an option

  • Save bsrz/72ccafe07322172073476beb0f90dcfc to your computer and use it in GitHub Desktop.

Select an option

Save bsrz/72ccafe07322172073476beb0f90dcfc to your computer and use it in GitHub Desktop.

Getting Started with Publish

$ mint bootstrap
$ mint run publish --help
Publish Command Line Interface
------------------------------
Interact with the Publish static site generator from
the command line, to create new websites, or to generate
and deploy existing ones.
Available commands:
- new: Set up a new website in the current folder.
- generate: Generate the website in the current folder.
- run: Generate and run a localhost server on default port 8000
for the website in the current folder. Use the "-p"
or "--port" option for customizing the default port.
- deploy: Generate and deploy the website in the current
folder, according to its deployment method.
$ mint run publish run
[...] # Dependencies being downloaded and built
Building for debugging...
Build complete! (0.14s)
Publishing HelloPublish (6 steps)
[1/6] Copy 'Resources' files
[2/6] Add Markdown files from 'Content' folder
[3/6] Sort items
[4/6] Generate HTML
[5/6] Generate RSS feed
[6/6] Generate site map
βœ… Successfully published HelloPublish
🌍 Starting web server at http://localhost:8001
Press ENTER to stop the server and exit
$ mkdir HelloPublish
$ cd HelloPublish
// swift-tools-version:5.5
import PackageDescription
let package = Package(
name: "HelloPublish",
platforms: [.macOS(.v12)],
products: [
.executable(
name: "HelloPublish",
targets: ["HelloPublish"]
)
],
dependencies: [
.package(name: "Publish", url: "https://github.com/johnsundell/publish.git", from: "0.9.0")
],
targets: [
.executableTarget(
name: "HelloPublish",
dependencies: ["Publish"]
)
]
)
$ mint run publish new
🌱 Finding latest version of Publish
🌱 Running publish-cli 0.9.0...
βœ… Generated website project for 'HelloPublish'
Run 'open Package.swift' to open it and start building
HelloPublish (root)
β”œβ”€β”€ Content
β”‚ β”œβ”€β”€ index.md
β”‚ └── posts
β”‚ β”œβ”€β”€ first-post.md
β”‚ └── index.md
β”œβ”€β”€ Mintfile
β”œβ”€β”€ Output
β”‚ β”œβ”€β”€ feed.rss
β”‚ β”œβ”€β”€ index.html
β”‚ β”œβ”€β”€ posts
β”‚ β”‚ β”œβ”€β”€ first-post
β”‚ β”‚ β”‚ └── index.html
β”‚ β”‚ └── index.html
β”‚ β”œβ”€β”€ sitemap.xml
β”‚ β”œβ”€β”€ styles.css
β”‚ └── tags
β”‚ β”œβ”€β”€ article
β”‚ β”‚ └── index.html
β”‚ β”œβ”€β”€ first
β”‚ β”‚ └── index.html
β”‚ └── index.html
β”œβ”€β”€ Package.resolved
β”œβ”€β”€ Package.swift
β”œβ”€β”€ Resources
└── Sources
└── HelloPublish
└── main.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment