Rename to skittle

This commit is contained in:
Michiel Borkent 2021-05-26 12:42:20 +02:00
parent 8906a59ab1
commit 07367e1781
9 changed files with 39 additions and 36 deletions

View file

@ -1,8 +1,8 @@
# sci.script-tag # Scittle
The [Small Clojure Interpreter](https://github.com/borkdude/sci) exposed for usage in script tags. The [Small Clojure Interpreter](https://github.com/borkdude/sci) exposed for usage in script tags.
See [Github pages](https://borkdude.github.io/sci-script-tag) for usage. See [Github pages](https://borkdude.github.io/scittle) for usage.
## Tasks ## Tasks
@ -12,10 +12,10 @@ Run `bb tasks` to see all available tasks:
$ bb tasks $ bb tasks
The following tasks are available: The following tasks are available:
clean Start from clean slate. clean Start from clean slate.
build:dev Development build. Starts webserver and watches for changes. dev Development build. Starts webserver and watches for changes.
build:release Builds release artifacts. prod Builds production artifacts.
release Updates Github pages with new release build. release Updates Github pages with new release build.
``` ```
## Credits ## Credits

8
bb.edn
View file

@ -2,9 +2,9 @@
{:requires ([babashka.fs :as fs]) {:requires ([babashka.fs :as fs])
clean {:doc "Start from clean slate." clean {:doc "Start from clean slate."
:task (run! fs/delete (fs/list-dir (fs/file "resources" "public" "js") "**.*"))} :task (run! fs/delete (fs/list-dir (fs/file "resources" "public" "js") "**.*"))}
build:dev {:doc "Development build. Starts webserver and watches for changes." dev {:doc "Development build. Starts webserver and watches for changes."
:task (clojure "-M:dev -m shadow.cljs.devtools.cli watch main")} :task (clojure "-M:dev -m shadow.cljs.devtools.cli watch main")}
build:release {:doc "Builds release artifacts." prod {:doc "Builds production artifacts."
:task (clojure "-M:dev -m shadow.cljs.devtools.cli release main")} :task (clojure "-M:dev -m shadow.cljs.devtools.cli release main")}
release {:doc "Updates Github pages with new release build." release {:doc "Updates Github pages with new release build."
:task (shell "script/release.clj")}}} :task (shell "script/release.clj")}}}

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
<script src="js/sci-script-tag.js" type="application/javascript"></script> <script src="js/scittle.js" type="application/javascript"></script>
<script type="application/x-sci"> <script type="application/x-sci">
(defn my-alert [] (defn my-alert []
(js/alert "You clicked!")) (js/alert "You clicked!"))
@ -11,12 +11,12 @@
</script> </script>
</head> </head>
<body> <body>
<h1>SCI script tag</h1> <h1>Scittle</h1>
<pre> <pre>
<code class="html"> <code class="html">
&lt;head&gt; &lt;head&gt;
&lt;script src=&quot;https://borkdude.github.io/sci-script-tag/js/sci-script-tag.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;https://borkdude.github.io/scittle/js/scittle.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;application/x-sci&quot;&gt; &lt;script type=&quot;application/x-sci&quot;&gt;
(defn my-alert [] (defn my-alert []

View file

@ -2,10 +2,10 @@
<html> <html>
<head> <head>
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
<script src="js/sci-script-tag.js" type="application/javascript"></script> <script src="js/scittle.js" type="application/javascript"></script>
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script> <script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> <script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
<script src="js/sci-script-tag-plugin-reagent.js" type="application/javascript"></script> <script src="js/scittle.reagent.js" type="application/javascript"></script>
<script type="application/x-sci"> <script type="application/x-sci">
(defn my-alert [] (defn my-alert []
(js/alert "You clicked!")) (js/alert "You clicked!"))
@ -32,31 +32,31 @@
</head> </head>
<body> <body>
<h1>SCI script tag</h1> <h1>Scittle</h1>
<h2>What is this?</h2> <h2>What is this?</h2>
<p>This project exposes the <a href="https://github.com/borkdude/sci">Small Clojure Interpreter</a> in the <p>This project exposes the <a href="https://github.com/borkdude/sci">Small Clojure Interpreter</a> in the
browser in such a way that you can use it with the <tt>script</tt> tag.</p> browser in such a way that you can use it with the <tt>script</tt> tag.</p>
<h2>Project status</h2> <h2>Project status</h2>
<p> <p>
This project is currently experimental and breaking changes are This project is currently experimental and breaking changes are
bound to happen. Feedback is welcome on <a href="https://github.com/borkdude/sci-script-tag">Github</a>.</p> bound to happen. Feedback is welcome on <a href="https://github.com/borkdude/scittle">Github</a>.</p>
<p> <p>
You can get a copy You can get a copy
of <tt>sci-script-tag.js</tt> <a href="https://borkdude.github.io/sci-script-tag/js/sci-script-tag.js">here</a>. If of <tt>scittle.js</tt> <a href="https://borkdude.github.io/scittle/js/scittle.js">here</a>. If
you want a pinned version of <tt>sci-script-tag.js</tt>, your best bet is to you want a pinned version of <tt>scittle.js</tt>, your best bet is to
download your own copy and host it yourself. download your own copy and host it yourself.
</p> </p>
<a name="usage"></a> <a name="usage"></a>
<h2><a href="#usage">Usage</a></h2> <h2><a href="#usage">Usage</a></h2>
Include <tt>sci-script-tag.js</tt> and write a <tt>script</tt> tag Include <tt>scittle.js</tt> and write a <tt>script</tt> tag
where <tt>type</tt> is set where <tt>type</tt> is set
to <tt>application/x-sci</tt>. to <tt>application/x-sci</tt>.
<pre> <pre>
<code class="html">&lt;head&gt; <code class="html">&lt;head&gt;
&lt;script src=&quot;https://borkdude.github.io/sci-script-tag/js/sci-script-tag.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;https://borkdude.github.io/scittle/js/scittle.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;application/x-sci&quot;&gt; &lt;script type=&quot;application/x-sci&quot;&gt;
(defn my-alert [] (defn my-alert []
@ -91,13 +91,13 @@
<h2><a href="#reagent">Reagent plugin</a></h2> <h2><a href="#reagent">Reagent plugin</a></h2>
To enable <a href="https://github.com/reagent-project/reagent">reagent</a>, To enable <a href="https://github.com/reagent-project/reagent">reagent</a>,
in addition to <tt>sci-script-tag.js</tt>, you need to include React in addition to <tt>scittle.js</tt>, you need to include React
and <tt>sci-script-tag-plugin-reagent.js</tt>: and <tt>scittle.reagent.js</tt>:
<pre><code class="html"> <pre><code class="html">
&lt;script crossorigin src=&quot;https://unpkg.com/react@17/umd/react.production.min.js&quot;&gt;&lt;/script&gt; &lt;script crossorigin src=&quot;https://unpkg.com/react@17/umd/react.production.min.js&quot;&gt;&lt;/script&gt;
&lt;script crossorigin src=&quot;https://unpkg.com/react-dom@17/umd/react-dom.production.min.js&quot;&gt;&lt;/script&gt; &lt;script crossorigin src=&quot;https://unpkg.com/react-dom@17/umd/react-dom.production.min.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;https://borkdude.github.io/sci-script-tag/js/sci-script-tag-plugin-reagent.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;https://borkdude.github.io/scittle/js/scittle.reagent.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;application/x-sci&quot;&gt; &lt;script type=&quot;application/x-sci&quot;&gt;
(require '[reagent.core :as r] (require '[reagent.core :as r]

View file

@ -2,11 +2,11 @@
<html> <html>
<head> <head>
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
<script src="js/sci-script-tag.js" type="application/javascript"></script> <script src="js/scittle.js" type="application/javascript"></script>
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script> <script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> <script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
<script src="js/sci-script-tag-plugin-reagent.js" type="application/javascript"></script> <script src="js/scittle.reagent.js" type="application/javascript"></script>
<script type="application/x-sci" src="cljs/tictactoe.cljs"></script> <script type="application/x-sci" src="cljs/tictactoe.cljs"></script>
@ -16,8 +16,8 @@
</head> </head>
<body> <body>
<h1>SCI script tag: Reagent tic-tac-toe</h1> <h1>Scittle tic-tac-toe</h1>
<h2>What is SCI script tag?</h2> <h2>What is Scittle?</h2>
<p>Read <a href="index.html">the main page</a> for more details.</p> <p>Read <a href="index.html">the main page</a> for more details.</p>
<h2>Reagent tic tac toe</h2> <h2>Reagent tic tac toe</h2>
<div id="app"></div> <div id="app"></div>

View file

@ -6,6 +6,9 @@
(fs/copy "resources/public/index.html" "gh-pages" (fs/copy "resources/public/index.html" "gh-pages"
{:replace-existing true}) {:replace-existing true})
(fs/copy "resources/public/base.html" "gh-pages"
{:replace-existing true})
(fs/copy "resources/public/tictactoe.html" "gh-pages" (fs/copy "resources/public/tictactoe.html" "gh-pages"
{:replace-existing true}) {:replace-existing true})
@ -40,7 +43,7 @@
(fs/copy f (fs/copy f
js-target-dir js-target-dir
{:replace-existing true})) {:replace-existing true}))
(fs/glob js-source-dir "sci-script-tag*.js")) (fs/glob js-source-dir "scittle*.js"))
(def with-gh-pages (partial shell {:dir "gh-pages"})) (def with-gh-pages (partial shell {:dir "gh-pages"}))
(with-gh-pages "git add .") (with-gh-pages "git add .")

View file

@ -13,9 +13,9 @@
"react-dom" {:target :global "react-dom" {:target :global
:global "ReactDOM"}}} :global "ReactDOM"}}}
:modules :modules
{:sci-script-tag {:entries [sci.script-tag]} {:scittle {:entries [scittle.core]}
:sci-script-tag-plugin-reagent {:entries [sci.script-tag.plugin-reagent] :scittle.reagent {:entries [scittle.reagent]
:depends-on #{:sci-script-tag}}} :depends-on #{:scittle}}}
:build-hooks [(shadow.cljs.build-report/hook)] :build-hooks [(shadow.cljs.build-report/hook)]
:output-dir "resources/public/js" :output-dir "resources/public/js"
:devtools {:repl-pprint true}}}} :devtools {:repl-pprint true}}}}

View file

@ -1,4 +1,4 @@
(ns sci.script-tag (ns scittle.core
(:refer-clojure :exclude [defn time]) (:refer-clojure :exclude [defn time])
(:require [clojure.core :as c] (:require [clojure.core :as c]
[goog.object :as gobject] [goog.object :as gobject]

View file

@ -1,8 +1,8 @@
(ns sci.script-tag.plugin-reagent (ns scittle.reagent
(:require [reagent.core :as r] (:require [reagent.core :as r]
[reagent.dom :as rdom] [reagent.dom :as rdom]
[sci.core :as sci] [sci.core :as sci]
[sci.script-tag :as st])) [scittle.core :as scittle]))
(def rns (sci/create-ns 'reagent.core nil)) (def rns (sci/create-ns 'reagent.core nil))
@ -14,7 +14,7 @@
(def reagent-dom-namespace (def reagent-dom-namespace
{'render (sci/copy-var rdom/render rdns)}) {'render (sci/copy-var rdom/render rdns)})
(st/register-plugin! (scittle/register-plugin!
::reagent ::reagent
{:namespaces {'reagent.core reagent-namespace {:namespaces {'reagent.core reagent-namespace
'reagent.dom reagent-dom-namespace}}) 'reagent.dom reagent-dom-namespace}})