Skip to content

Commit

Permalink
add inline-styles; bump 0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Nov 7, 2017
1 parent 56b0b05 commit 6cb9d41
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Shell Page (generator)
### Usage

```edn
[mvc-works/shell-page "0.1.5"]
[mvc-works/shell-page "0.1.6"]
```

```clojure
Expand All @@ -19,6 +19,7 @@ Shell Page (generator)
:icon "http://icon-url.png"
:ssr "respo-ssr"
:styles ["main.css"]
:inline-styles [".app{color: #ddd;}"]
:scripts ["main.js"]
:inline-html ""
:append-html ""})
Expand Down
2 changes: 1 addition & 1 deletion build.boot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:username "jiyinyiyong"
:password (read-password "Clojars password: ")}]))

(def +version+ "0.1.5")
(def +version+ "0.1.6")

(deftask deploy []
(comp
Expand Down
2 changes: 1 addition & 1 deletion coir.edn

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"http-server": "^0.10.0",
"shadow-cljs": "^2.0.32"
"shadow-cljs": "^2.0.62"
},
"dependencies": {}
}
9 changes: 8 additions & 1 deletion src/shell_page/core.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

(ns shell-page.core
(:require (respo.macros :refer [html <> head title script style meta' div link body list->])
(:require (respo.macros
:refer
[html <> head title script style meta' div link body style list->])
[respo.render.html :refer [make-string]]
["fs" :as fs]))

Expand All @@ -26,6 +28,11 @@
(->> (:styles resources)
(map-indexed
(fn [idx path] [idx (link {:rel "stylesheet", :type "text/css", :href path})]))))
(list->
:div
{}
(->> (:inline-styles resources)
(map-indexed (fn [idx content] [idx (style {:innerHTML content})]))))
(div {:class-name "app", :innerHTML html-content})
(if (some? (:inline-html resources)) (div {:innerHTML (:inline-html resources)}))
(list->
Expand Down
1 change: 1 addition & 0 deletions src/shell_page/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:icon "http://logo.mvc-works.org/mvc.png",
:ssr "respo-ssr",
:styles ["/main.css"],
:inline-styles [".app{color:#aaa;}"],
:scripts ["/main.js"],
:inline-html "<script>console.log('nothing')</script>",
:append-html "<script>console.log('appended');</script>"})))
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1188,9 +1188,9 @@ shadow-cljs-jar@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/shadow-cljs-jar/-/shadow-cljs-jar-0.10.0.tgz#9895e6e5ccfde1c7b673737b1dfd9149194b644f"

shadow-cljs@^2.0.32:
version "2.0.46"
resolved "https://registry.yarnpkg.com/shadow-cljs/-/shadow-cljs-2.0.46.tgz#38794623b1cdcaf1363532576341ddf830583c36"
shadow-cljs@^2.0.62:
version "2.0.63"
resolved "https://registry.yarnpkg.com/shadow-cljs/-/shadow-cljs-2.0.63.tgz#a91fe9eaaaf94a97c70ed7e1117205426e3f0438"
dependencies:
babel-core "^6.26.0"
babel-preset-env "^1.6.0"
Expand Down

0 comments on commit 6cb9d41

Please sign in to comment.