Git Product home page Git Product logo

clj-cljs-app's Introduction

Clj / Cljs App

An extraction of our main app at Cognician.

Minimum Requirements

A JDK supporting the Java Platform Module System (>= JDK 9). If your distro's default JDK is version 8 or older, you will need to upgrade before building this app.

Usage

Clone this repo, run the commands explained below to see it in action, and then use it as a reference to create (or alter) your own app.

Contents

It composes the following:

The clojure runtime, and tools.deps.alpha for Clojure dependency management.

An nREPL server for a pure Clojure REPL, with CIDER and clj-refactor middleware included.

Shadow CLJS, which has:

  • An empty app, with working dev and release builds, and a working ClojureScript REPL.
  • A Clojure + ClojureScript REPL, via shadow's system, with CIDER and clj-refactor middleware included.
  • A package.json, for bringing in libraries from npm.
  • We don't provide an explicit ClojureScript dependency; we simply use the one Shadow CLJS provides.

A Makefile, to encapsulate the various commands that make this all happen.

Clojure and ClojureScript REPL in action

Run npm install. You only need to do this bit once (unless you add/upgrade versions to package.json).

Run make. This will start a shadow-cljs REPL capable of both pure Clojure and Clojure+ClojureScript repl connections from Emacs.

From Emacs, run the M-x cider-connect-clj&cljs command, and select :shadow when prompted.

In a new terminal, run make http. (I assume you have a basic Python installed so you can start this service up!)

Browse to http://localhost:8000/app.html. You should be able to write and evaluate this, and see it happen in your browser:

(js/window.alert "hello from Emacs")

See Makefile for more goodies!

CIDER Clojure Refresh in action

Once your Clojure or Clojure+ClojureScript repl is connected, you can run the M-x cider-ns-refresh to reload your code. The start and stop functions in clj-cljs-app.main give you hooks to handle the lifecycle of your application entrypoint.

References

Clojure

https://clojure.org/guides/getting_started#_clojure_installer_and_cli_tools

https://clojure.org/reference/deps_and_cli

Clojurians Slack: #clojure

CIDER

https://cider.mx/

Clojurians Slack: #cider

clj-refactor

https://github.com/clojure-emacs/clj-refactor.el

Clojurians Slack: No specific one, but #emacs will probably help!

Shadow-CLJS

https://shadow-cljs.github.io/docs/UsersGuide.html

Clojurians Slack: #shadow-cljs

clj-cljs-app's People

Contributors

rdipardo avatar robert-stuttaford avatar thheller avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.