Skip to content

Review and document Silk Clojure and ClojureScript APIs #103

@Shnick

Description

@Shnick

Clojure

(ns my.project
  (:require [silk.core.server :as silk]
            [silk.cli.api :as silkcli]))

(def data
  [{:title "Room - Hall"
    :description "The Hall of at home"
    :links [{:transition-type "Door"
             :direction "West"
             :title "Enter"
             :href "http://www.silkyweb.org"}]}])

; Bind markup with data and inject into tag ID
(silk/spin-by-id "index.html" "my-id" data)

; Bind data for each `data-sw-source` in markup
(silk/spin-by-data-sw-source "index.html")

; Spins an entire project stiching together templates, views, components
; and injects data where specifed. Params are reload? directory live? trace?
(silkcli/spin-or-reload false "~/path/to/project" false false)

ClojureScript

(ns my.project
  (:require [silk.core.browser :as silk]))

(def data
  [{:title "Room - Hall"
    :description "The Hall of at home"
    :links [{:transition-type "Door"
             :direction "West"
             :title "Enter"
             :href "http://www.silkyweb.org"}]}])

; Bind markup with data and inject into tag ID 
(silk/spin-by-id js/document "my-id" data)

; Bind data for each `data-sw-source` in markup
(silk/spin-by-data-sw-source js/document)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions