Permalink
Browse files

CLJS-2558: Add logo to browser REPL default index.html

  • Loading branch information...
mfikes authored and swannodette committed Feb 26, 2018
1 parent ec0e4c4 commit adba8f7f45eeb6700cc43e71abef4f40557b23b3
Showing with 49 additions and 4 deletions.
  1. +1 −1 deps.edn
  2. BIN resources/cljs-logo-icon-32.png
  3. +18 −0 resources/cljs-logo.svg
  4. +30 −3 src/main/clojure/cljs/repl/browser.clj
@@ -1,4 +1,4 @@
{:paths ["src/main/clojure" "src/main/cljs"]
{:paths ["src/main/clojure" "src/main/cljs" "resources"]
:deps
{org.clojure/clojure {:mvn/version "1.9.0"}
org.clojure/tools.reader {:mvn/version "1.3.0-alpha3"}
Binary file not shown.
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
The CLJS logo is released under a Creative Commons CC0 license: https://creativecommons.org/publicdomain/zero/1.0/
For more information about the logo, please see: https://github.com/cljs/logo
-->
<svg width="438px" height="438px" viewBox="0 0 438 438" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<circle fill="#FFFFFF" cx="219" cy="219" r="219"></circle>
<g transform="translate(20.000000, 21.000000)">
<g transform="translate(69.000000, 131.000000)">
<path fill="#96CA4B" d="M39,119.6 C26.3,119.6 16.7,115.9 10.1,108.5 C3.5,101.1 0.2,90.5 0.2,76.7 C0.2,62.6 3.6,51.8 10.5,44.2 C17.4,36.6 27.3,32.8 40.4,32.8 C49.2,32.8 57.2,34.4 64.2,37.7 L58.8,52 C51.3,49.1 45.1,47.6 40.2,47.6 C25.7,47.6 18.5,57.2 18.5,76.4 C18.5,85.8 20.3,92.8 23.9,97.6 C27.5,102.3 32.8,104.7 39.8,104.7 C47.7,104.7 55.2,102.7 62.3,98.8 L62.3,114.3 C59.1,116.2 55.7,117.5 52.1,118.3 C48.5,119.2 44.1,119.6 39,119.6 L39,119.6 Z"></path>
<path fill="#96CA4B" d="M111.4,118.1 L93.6,118.1 L93.6,0.3 L111.4,0.3 L111.4,118.1 L111.4,118.1 Z"></path>
<path fill="#5F7FBF" d="M139.9,155.3 C134.6,155.3 130.1,154.7 126.6,153.4 L126.6,139.3 C130,140.2 133.5,140.7 137.1,140.7 C144.7,140.7 148.5,136.4 148.5,127.8 L148.5,34.3 L166.3,34.3 L166.3,129 C166.3,137.6 164,144.2 159.5,148.6 C154.9,153.1 148.4,155.3 139.9,155.3 L139.9,155.3 Z M147.4,12.2 C147.4,9 148.3,6.6 150,4.9 C151.7,3.2 154.2,2.3 157.5,2.3 C160.6,2.3 163.1,3.2 164.8,4.9 C166.5,6.6 167.4,9.1 167.4,12.2 C167.4,15.2 166.5,17.6 164.8,19.4 C163.1,21.1 160.6,22 157.5,22 C154.3,22 151.8,21.1 150,19.4 C148.2,17.6 147.4,15.2 147.4,12.2 L147.4,12.2 Z"></path>
<path fill="#5F7FBF" d="M259.5,94.3 C259.5,102.5 256.5,108.7 250.6,113.1 C244.6,117.5 236.1,119.6 225,119.6 C213.8,119.6 204.9,117.9 198.1,114.5 L198.1,99.1 C207.9,103.6 217.1,105.9 225.6,105.9 C236.5,105.9 242,102.6 242,96 C242,93.9 241.4,92.1 240.2,90.7 C239,89.3 237,87.8 234.2,86.3 C231.4,84.8 227.6,83.1 222.6,81.2 C213,77.5 206.4,73.7 203,70 C199.6,66.3 197.9,61.4 197.9,55.5 C197.9,48.3 200.8,42.8 206.6,38.8 C212.4,34.8 220.2,32.9 230.2,32.9 C240,32.9 249.3,34.9 258.1,38.9 L252.3,52.3 C243.3,48.6 235.7,46.7 229.5,46.7 C220.1,46.7 215.4,49.4 215.4,54.7 C215.4,57.3 216.6,59.5 219.1,61.4 C221.5,63.2 226.9,65.7 235.1,68.9 C242,71.6 247,74 250.2,76.2 C253.3,78.4 255.6,81 257.2,83.9 C258.7,86.7 259.5,90.2 259.5,94.3 L259.5,94.3 Z"></path>
</g>
<path stroke="#96CA4B" stroke-width="6" fill="#96CA4B" d="M183,376.7 C91.8,368.6 20,291.7 20,198.4 C20,105.1 91.8,28.3 183,20.2 L183,0.1 C80.7,8.3 0,94.1 0,198.5 C0,302.9 80.7,388.7 183,396.9 L183,376.7 L183,376.7 Z"></path>
<path stroke="#5F7FBF" stroke-width="6" fill="#5F7FBF" d="M215,0.1 L215,20.2 C306.2,28.3 378,105.2 378,198.5 C378,291.8 306.2,368.7 215,376.8 L215,396.9 C317.3,388.7 398,302.9 398,198.5 C398,94.1 317.3,8.3 215,0.1 L215,0.1 Z"></path>
</g>
</svg>
@@ -35,6 +35,7 @@
".jpg" "image/jpeg"
".png" "image/png"
".gif" "image/gif"
".svg" "image/svg+xml"
".js" "text/javascript"
".json" "application/json"
@@ -50,6 +51,7 @@
"image/jpeg" "ISO-8859-1"
"image/png" "ISO-8859-1"
"image/gif" "ISO-8859-1"
"image/svg+xml" "UTF-8"
"text/javascript" "UTF-8"
"text/x-clojure" "UTF-8"
"application/json" "UTF-8"})
@@ -127,10 +129,35 @@
(server/send-and-close conn 200 (slurp local-path) "text/plain"))
;; "/index.html" doesn't exist, provide our own
(= path "/index.html")
(let [{:keys [output-to] :or {output-to "out/main.js"}} copts]
(let [{:keys [output-dir output-to] :or {output-dir "out" output-to "out/main.js"}} copts]
(let [maybe-copy-resource (fn [name] (let [f (io/file output-dir name)]
(when-not (.exists f)
(spit f (slurp (io/resource name))))))]
(maybe-copy-resource "cljs-logo-icon-32.png")
(maybe-copy-resource "cljs-logo.svg"))
(server/send-and-close conn 200
(str "<!DOCTYPE html><head><meta charset=\"UTF-8\"></head><body>"
"<div id=\"app\"></div>"
(str "<!DOCTYPE html><html><head><meta charset=\"UTF-8\">"
"<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"" output-dir "/cljs-logo-icon-32.png\"/></head>"
"<body><div id=\"app\">"
"<p>Welcome to the default <code>index.html</code> provided by the ClojureScript Browser REPL.</p>"
"<p>This page provides the evaluation environment for your Browser REPL and application.</p>"
"<p>You can quickly validate the connection by typing <code>(js/alert&nbsp;\"Hello CLJS!\")</code> into the "
"ClojureScript REPL that launched this page.</p><p>You can easily use your own HTML file to host your application "
"and REPL by providing your own <code>index.html</code> in the directory that you launched this REPL from.</p>"
"<p>Start with this template:</p>"
"<pre>"
"&lt;!DOCTYPE html&gt;\n"
"&lt;html&gt;\n"
" &lt;head&gt;\n"
" &lt;meta charset=\"UTF-8\"&gt;\n"
" &lt;/head&gt;\n"
" &lt;body&gt;\n"
" &lt;script src=\"" output-to "\" type=\"text/javascript\"&gt;&lt;/script&gt;\n"
" &lt;/body&gt;\n"
"&lt;/html&gt;\n"
"</pre>"
"<center><img src=\"" output-dir "/cljs-logo.svg\" style=\"width: 350px; height: 350px;\"/></center>"
"</div></div>"
"<script src=\"" output-to "\"></script>"
"</body></html>")
"text/html"

0 comments on commit adba8f7

Please sign in to comment.