diff --git a/shadow-cljs.edn b/shadow-cljs.edn index b09b7e4..30d8418 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -15,7 +15,9 @@ :modules {:scittle {:entries [scittle.core]} :scittle.reagent {:entries [scittle.reagent] - :depends-on #{:scittle}}} + :depends-on #{:scittle}} + :scittle.makro-plugin {:entries [scittle.makro-plugin] + :depends-on #{:scittle}}} :build-hooks [(shadow.cljs.build-report/hook)] :output-dir "resources/public/js" :devtools {:repl-pprint true}}}} diff --git a/src/scittle/makro_plugin.cljs b/src/scittle/makro_plugin.cljs new file mode 100644 index 0000000..da290ba --- /dev/null +++ b/src/scittle/makro_plugin.cljs @@ -0,0 +1,17 @@ +(ns scittle.makro-plugin + (:require + [sci.core :as sci] + [scittle.core :as scittle])) + +(defn add-low-fn [_env _form x y & zs] `(str "__" ~x ~y ~zs)) +(def add-low-makro (with-meta add-low-fn {:sci/macro true})) + +(def rns (sci/create-ns 'makro-plugin.core nil)) + +(def makro-plugin-namespace + {'add-low-fn (sci/copy-var add-low-fn rns) + 'add-low-makro (sci/copy-var add-low-makro rns)}) + +(scittle/register-plugin! + ::makro-plugin + {:namespaces {'makro-plugin.core makro-plugin-namespace}}) diff --git a/test.html b/test.html new file mode 100644 index 0000000..3180191 --- /dev/null +++ b/test.html @@ -0,0 +1,21 @@ + +
+ + + + + + + +