Giter Site home page Giter Site logo

p-adams / figwheel-main-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bhauman/figwheel-main-template

0.0 1.0 0.0 50 KB

A template to generate a minimal figwheel-main based ClojureScript project

Home Page: http://rigsomelight.com/figwheel-main-template/

License: Eclipse Public License 1.0

Clojure 73.65% HTML 24.57% CSS 1.78%

figwheel-main-template's Introduction

figwheel.main template

A template generator that will produce a minimal ClojureScript project that includes figwheel.main tooling.

Abridged Usage Examples

Already an expert? Can't stand to read more information? Assuming you have lein or clj-new installed, you can use one of the following commands:

clj -A:new figwheel-main hello-world.core -- --reagent # or --rum, --om, --react or nothing

or

lein new figwheel-main hello-world.core -- --reagent # or --rum, --om, --react or nothing

Overview

The figwheel-main template is intended to get you up and running with a no-frills ClojureScript project initialized with the ClojureScript React framework of your choosing. It is intended to work equally well with Leiningen or clj-new.

Usage

Using clj-new

Make sure you have installed the Clojure CLI tools and are running the latest version.

Also, ensure you have installed clj-new as detailed here

clj -A:new figwheel-main hello-world.core -- --reagent

Using lein

Make sure you have the latest version of Leiningen installed.

lein new figwheel-main hello-world.core -- --reagent

Options

Takes a name and possibly a single framework option with the form --framework and any number of attribute options of the form +attribute and produces a minimal ClojureScript project that includes Figwheel Main tooling

The initial name option is intended to be the name of your initial project namespace. Here are some examples of valid project names:

hello.core
my.group/dominate.world

The framework options are:

 --react   which adds a minimal React/Sablono application in core.cljs
 --reagent which adds a minimal Reagent application in core.cljs
 --rum     which adds a minimal Rum application in core.cljs
 --om      which adds a minimal Om application in core.cljs

The attribute options are:

 +deps        which generates a deps.edn (a default when used with clj-new)
 +lein        which generates a project.clj (a default when used with lein)
 +bare-index  which generates an index without any annoyingly helpful content

Only one framework option can be specified at a time. If no framework option is specified, nothing but a print statment is added to the generated ClojureScript code.

Examples:

lein new figwheel-main hello-world.core -- --react +deps

clj -A:new figwheel-main hello-world.core -- --react +bare-index +lein

Compiling the generated project

With a CLI tools project

To get an interactive development environment change into the project root (the directory just created) and execute:

clojure -A:fig:build

After the compilation process is complete, and a browser has popped open the compiled project in your browser, you will get a ClojureScript REPL prompt that is connected to the browser.

An easy way to verify this is:

cljs.user=> (js/alert "Am I connected?")

and you should see an alert in the browser window.

You can also supply arguments to figwheel.main like so:

clojure -A:fig -b dev -r

To clean all compiled files:

rm -rf target/public

To create a production build:

rm -rf target/public
clojure -A:fig:min

With Leiningen based project

To get an interactive development environment change into the project root (the directory just created) and execute:

lein fig:build

After the compilation process is complete, and a browser has popped open the compiled project in your browser, you will get a ClojureScript REPL prompt that is connected to the browser.

An easy way to verify this is:

cljs.user=> (js/alert "Am I connected?")

and you should see an alert in the browser window.

You can also supply arguments to figwheel.main like so:

lein fig -- -b dev -r

To clean all compiled files:

lein clean

To create a production build:

lein clean
lein fig:min

Testing

Your initial tests are in the test directory. You will have tests that are updated live with each file change if you open a tab to http://localhost:9500/figwheel-extra-main/auto-testing

You can run your tests from the command line with:

clj -A:fig:test

or with lein:

lein fig:test

Questions?

See the figwheel.main documentation

Hit me up on the Clojurians Slack on the #figwheel-main channel.

License

Copyright © 2018 Bruce Hauman

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

figwheel-main-template's People

Contributors

artesonraju avatar bhauman avatar ckampfe avatar danielcompton avatar djebbz avatar laurio avatar p-adams avatar paulbutcher avatar

Watchers

 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.