Fork me on GitHub
#lumo
<
2018-03-09
>
phil16:03:26

Hey all.

phil16:03:18

I've been using Lumo for a little internal project and it's been brilliantly simple so far. However, I'm at the point I need ("need") to write a macro, I've honestly no idea how though.

phil16:03:39

Given the self-hostedness thing.

phil16:03:06

Any docs/tips?

phil16:03:40

I'm guessing I need to setup the normal clojurescript compiler for the project too?

mfikes16:03:09

@phil You can write macros just as you would with JVM ClojureScript. The only difference is that the macro namespace will be compiled as ClojureScript instead of Clojure.

mfikes16:03:47

So, just put your macro in a *.clj file and don’t use any Clojure interop and it will work.

phil16:03:12

@mfikes Would I need to compile that first?

phil16:03:27

Sorry, I feel like this is daft questioning.

mfikes16:03:53

No, if you, for example (require-macros ...) on that namespace in the REPL it will compile it using the self-hosted compiler.

phil16:03:59

Ah, amazing!

phil16:03:14

Thanks for your help.

mfikes16:03:16

(That’s why the code in the macro needs to be “pure”, and not rely on Clojure.)

phil16:03:16

All working - brilliant stuff.

snoe17:03:36

Hey all. I’m trying to run a script that is doing a (js/require "dep") that is installed in my project root from npm install. I would like to run lumo from outside the project however and dep cannot be found, is there a way to specify where to look for node_modules or set a working dir?