Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do I do with ClojureScript One?

This is a wonderful project, but where to start?

I thought about making my own github fork for my own project. Or making a branch for each project "inside" of it.

Perhaps I do not really understand this social coding stuff yet -- but I am really feeling the allergy I have with "encapsulated" or "encapsulating" software frameworks and development environments.

Should one make a project inside of the source files, sitting next to the one.sample app? There are so many directories I do not know where to begin. Shouldn't most of the One project be sitting in clojars for us to use and spit out our own app templates, a bit like lein noir new <appname>?

Any and all insights appreciated, thank you!

like image 327
humasect Avatar asked Feb 25 '12 17:02

humasect


People also ask

What is ClojureScript used for?

ClojureScript is a compiler for Clojure that targets JavaScript. It is designed to emit JavaScript code which is compatible with the advanced compilation mode of the Google Closure optimizing compiler.

How do I start ClojureScript project?

run lein new ... or get a project set up any way you like (an essential setup is just a project. clj and a source file) cd into project; run npm init and set up the npm part. run npm install -D shadow-cljs react react-dom and leave npm land.

What is reagent ClojureScript?

Reagent is a ClojureScript wrapper around React. It gives you a way to easily create React components. Reagent has three main features that make it easy to use: using functions to create React components, using Hiccup to generate HTML, and storing state in Reagent Atoms.

What is the difference between Clojure and ClojureScript?

At the time of writing, Clojure can run on the Java JVM, . NET CLR and JS engines. ClojureScript refers to the Clojure → JS compiler but within the community it's also used for Clojure code that runs on JS engines (i.e. doesn't contain Java API calls).


2 Answers

In episode 3 of the Think Relevance podcast Brenton Ashworth says that at the moment there are three ways to take advantage of ClojureScript One (18min 38sec):

  1. Copy the ClojureScript One project into your own project
  2. Fork the ClojureScript One repo, delete the sample application, and build your own application inside the ClojureScript One project
  3. Look at how CloureSript One handles dependencies, and then use the same approach to setup ClojureScript One as a dependency of your own project.

Sounds like the project team are aware of this being awkward at the moment, and they hope to be able to come up with a better story for this in the future.

like image 137
liwp Avatar answered Sep 28 '22 10:09

liwp


To be honest with you.... I've had a ridiculous amount of trouble with clojurescript one. There's just too much code to work with and its good for a reference but not when beginners to clojurescript are just starting out.

The best way to get started with clojurescript is with chris granger's https://github.com/ibdknox/cljs-template

start your project with:

lein new cljs-template <your project name>

cd <your project name>

lein run

That's it... just go into the src/client directory and start coding! basically, the template gives you a complete project that:

  • serves pages through ring
  • has cljs compilation on save so there is no need to muck around with lein cljsbuild

There is a 'clone' of clojurescript-one https://github.com/zcaudate/cljs-template-one made using cljs-template as a guide. It can be used as a project template:

lein new cljs-template-one <your project name>
cd <your project name>
chmod +x bootstrap.sh && ./bootstrap.sh

lein run

The project uses the twitter/bootstrap html template and can be viewed here: http://cljs-bootstrapped.herokuapp.com/

like image 45
zcaudate Avatar answered Sep 28 '22 10:09

zcaudate