Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/alexito4/ReadingTimePublishPlugin
- Owner: alexito4
- License: mit
- Created: 2020-01-04T11:07:04.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-13T20:47:34.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T17:13:24.561Z (13 days ago)
- Topics: publish-plugin, reading-time
- Language: Swift
- Homepage:
- Size: 32.2 KB
- Stars: 31
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-publish - Reading Time
README
# PublishReadingTime
[![](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)
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)