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.
See [Github pages](https://borkdude.github.io/sci-script-tag) for usage.
See [Github pages](https://borkdude.github.io/scittle) for usage.
## Tasks
@ -12,10 +12,10 @@ Run `bb tasks` to see all available tasks:
$ bb tasks
The following tasks are available:
clean Start from clean slate.
build:dev Development build. Starts webserver and watches for changes.
build:release Builds release artifacts.
release Updates Github pages with new release build.
clean Start from clean slate.
dev Development build. Starts webserver and watches for changes.
prod Builds production artifacts.
release Updates Github pages with new release build.
```
## Credits

8
bb.edn
View file

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

View file

@ -2,7 +2,7 @@
<html>
<head>
<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">
(defn my-alert []
(js/alert "You clicked!"))
@ -11,12 +11,12 @@
</script>
</head>
<body>
<h1>SCI script tag</h1>
<h1>Scittle</h1>
<pre>
<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;
(defn my-alert []

View file

@ -2,10 +2,10 @@
<html>
<head>
<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-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">
(defn my-alert []
(js/alert "You clicked!"))
@ -32,31 +32,31 @@
</head>
<body>
<h1>SCI script tag</h1>
<h1>Scittle</h1>
<h2>What is this?</h2>
<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>
<h2>Project status</h2>
<p>
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>
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
you want a pinned version of <tt>sci-script-tag.js</tt>, your best bet is to
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>scittle.js</tt>, your best bet is to
download your own copy and host it yourself.
</p>
<a name="usage"></a>
<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
to <tt>application/x-sci</tt>.
<pre>
<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;
(defn my-alert []
@ -91,13 +91,13 @@
<h2><a href="#reagent">Reagent plugin</a></h2>
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
and <tt>sci-script-tag-plugin-reagent.js</tt>:
in addition to <tt>scittle.js</tt>, you need to include React
and <tt>scittle.reagent.js</tt>:
<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-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;
(require '[reagent.core :as r]

View file

@ -2,11 +2,11 @@
<html>
<head>
<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-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>
@ -16,8 +16,8 @@
</head>
<body>
<h1>SCI script tag: Reagent tic-tac-toe</h1>
<h2>What is SCI script tag?</h2>
<h1>Scittle tic-tac-toe</h1>
<h2>What is Scittle?</h2>
<p>Read <a href="index.html">the main page</a> for more details.</p>
<h2>Reagent tic tac toe</h2>
<div id="app"></div>

View file

@ -6,6 +6,9 @@
(fs/copy "resources/public/index.html" "gh-pages"
{:replace-existing true})
(fs/copy "resources/public/base.html" "gh-pages"
{:replace-existing true})
(fs/copy "resources/public/tictactoe.html" "gh-pages"
{:replace-existing true})
@ -40,7 +43,7 @@
(fs/copy f
js-target-dir
{: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"}))
(with-gh-pages "git add .")

View file

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

View file

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

View file

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