Fork me on GitHub
#emacs
<
2016-11-29
>
tianshu06:11:35

sounds great, i'm going to have try

tianshu06:11:57

@ewen How can I use it with my figwheel project? or is it neccessary still using figwheel with replique?

ewen09:11:07

@doglooksgood No, you don't need figwheel

tianshu09:11:57

when I start replique/cljs-repl, It let me to open a port with browser. But that page is not the page that contains my cljs code.

tianshu09:11:05

If there's a tutorial or video for development basic setup, step by step, that will be great help.

ewen09:11:07

if you are not using the cljs repl in the context of a web app, cljs files are not loaded automatically, you must manually load a cljs file to execute something in the browser

ewen09:11:33

if you want somthing to execute automatically, you must use a web server and output a main js file

tianshu09:11:37

I'm using cljs repl of a web app. My cljs code will be run in browser

ewen09:11:58

in both cases it will run in the browser

ewen09:11:24

is your cljs repl started ?

tianshu09:11:02

Which cljs build will be used by replique/cljs-repl?

ewen09:11:42

the one which does not automatically load you cljs code

ewen09:11:06

you must M-x replique/load-file a cljs file

ewen09:11:05

hum sorry i misread you question

ewen09:11:30

replique/cljs-repl starts a cljs repl, which is not dependant of the js runtime

ewen09:11:00

to execute js code, you must connect a browser to the cljs repl

ewen09:11:25

the easiest way is to open a browser tab on localhost:<repl-port>

ewen09:11:41

and then typing something at the REPL or loading a file

ewen09:11:59

but sometimes you want to use the cljs repl to develop a webapp (ie you are serving web assets from a webserver and want the web pages served by the web server to automatically connect to the cljs repl)

ewen09:11:18

without writing cljs repl specific code

ewen09:11:51

outputting a main-js file let you do that, you can output a main js file and link it into you html markup (thats the main entry point of your application, which also happen to connect to the cljs repl)

tianshu09:11:39

with cljsbuild I have a main.js, included in index.html. if my web server is running at localhost:5000. I can open my index page with localhost:5000/index.html.

tianshu09:11:14

how can main.js find replique/cljs-repl?

ewen09:11:00

you must start a cljs repl, load your main cljs namespace (ie your entry point, and then use replique/output-main-js-file -> you will be prompted for the ouput path of the file (ie the "main.js" file in you comment above) and then you will be prompted for the main cljs namespace (ie the namespace that will be executed on startup)

ewen09:11:50

then you can link this file in you index.html

ewen09:11:31

of course you must output this file in your web server assets folder

ewen09:11:09

and the reason the cljs namespace must be loaded before using replique/output-main-js-file is because replique will query the cljs compiler in order to prompt you for a cljs namespace, thus this namespace must be loaded beforehand

tianshu09:11:48

this make sense, I will have a try, thank you!

ewen09:11:59

great 🙂