Swiftpack.co -  alephao/Stencil-CLI as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
alephao/Stencil-CLI
Render a Stencil template by using a JSON or Yaml data source
.package(url: "https://github.com/alephao/Stencil-CLI.git", from: "v0.0.6")

Stencil CLI

A CLI tool to render Stencil templates by using a JSON or Yaml data source.

Tags and filters from StencilSwiftKit are supported.

Installing

Using Homebrew

brew install alephao/formulae/stencil

Using Mint:

$ mint install alephao/Stencil-CLI

Using Make

$ git clone https://github.com/alephao/Stencil-CLI.git
$ cd stencil-cli
$ make install

Usage

$ stencil render -t path/to/template.stencil -d path/to/datasource.yaml -o path/to/output

Example

Given the stencil template

extension Color {
    {% for color in colors %}
    public static let {{ color.name }} = Color(hex: 0x{{ color.hex }})
    {% endfor %}
}

And the yaml file

colors:
- name: color1
  hex: '111111'
- name: color2
  hex: '222222'
- name: color3
  hex: '333333'
- name: color4
  hex: '444444'

stencil-cli generates

extension Color {
    public static let color1 = Color(hex: 0x111111)
    public static let color2 = Color(hex: 0x222222)
    public static let color3 = Color(hex: 0x333333)
    public static let color4 = Color(hex: 0x444444)
}

Attributions

This tool is powered by:

License

Stencil CLI is available under the MIT license. See LICENSE for more information.

GitHub

link
Stars: 11
Last commit: 1 year ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

v0.0.6 - Homebrew Support
1 year ago

Changes

Updated Makefile to make it compatible with homebrew

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics