Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexito4/ReadingTimePublishPlugin

Reading time estimation plugin for Publish.
https://github.com/alexito4/ReadingTimePublishPlugin

publish-plugin reading-time

Last synced: 1 day ago
JSON representation

Reading time estimation plugin for Publish.

Awesome Lists containing this project

README

        

# PublishReadingTime


Status

[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Falexito4%2FReadingTimePublishPlugin%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/alexito4/ReadingTimePublishPlugin)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Falexito4%2FReadingTimePublishPlugin%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/alexito4/ReadingTimePublishPlugin)

Publish Plugin


Twitter: @alexito4

Reading time estimation plugin for [Publish](https://github.com/JohnSundell/Publish).

## Installation

Start by adding the dependency to your project:

```swift
dependencies: [
...
.package(name: "ReadingTimePublishPlugin", url: "https://github.com/alexito4/ReadingTimePublishPlugin", from: "0.2.0")
],
```

Then assign it to your target:

```swift
targets: [
.target(
name: "Foo",
dependencies: [
"Publish",
...
"ReadingTimePublishPlugin"
]
)
]
```

## Usage

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

```swift
import ReadingTimePublishPlugin
...
try DeliciousRecipes().publish(using: [
...
.addMarkdownFiles(),
.installPlugin(.readingTime()),
...
])
```
Note that it must be installed after the Items are created (in this case by `addMarkdownFiles()` ).

Then you can add the information on your Theme:

```swift
HTML(...
.p("\(item.readingTime.minutes) minutes"),
...
```

# Author

Alejandro Martinez | http://alejandromp.com | [@alexito4](https://twitter.com/alexito4)