Contents

rockfordwei/perfect-squishy

**NOTE** This is not an official product of Perfect. However, Squishy is an independent parser library which can translate a "squishy" file into a Perfect Swift handler.

Squishy Syntax

A Squishy web page can have three different types of scripts natively:

  • HTML. This is the default format. NOTE The only feature you may take interests here is that Swift Interpolation \(variable) is available here.
  • Global Swift Code. Content marked inside <% ... %> will be translated into a swift program in the current name space.
  • Perfect Route Handler. Content that marked with ` will be treated as a standard named Perfect Route Handler, where the two key variables request: HTTPRequest and response: HTTPResponse` are available in this section.

Prerequisites

Swift 4.0 toolchain.

Package.swift

.package(url: "https://github.com/RockfordWei/Perfect-Squishy.git", 
from: "1.0.1")

...
dependencies: ["PerfectSquishy"]

Usage

The following snippet can translate the above "x.squishy" file into "y.swift":

import PerfectSquishy

let from = "x.squishy"
let to = "y.swift"
let parser = Squishy(handler: "handlerX", from: from, to: to)
try parser.parse()

Further Information

For more information on the Perfect project, please visit perfect.org.

Now WeChat Subscription is Available (Chinese)

<p align=center><img src="https://raw.githubusercontent.com/PerfectExamples/Perfect-Cloudinary-ImageUploader-Demo/master/qr.png"></p>

Package Metadata

Repository: rockfordwei/perfect-squishy

Default branch: master

README: README.md