Created
November 18, 2016 22:18
-
-
Save zehnpaard/e5fa2f6ee64d2b72217aba07f7f35dbc to your computer and use it in GitHub Desktop.
Minimal ClojureScript/Reagent/Figwheel setup for automatic CSS loading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns min-css.core | |
(:require | |
[reagent.core :as r])) | |
(defn my-app [] | |
[:div | |
[:h1 "Hello Reagent"] | |
[:p "Some random text in a regular p tag"] | |
[:p.my-class "More random text in a my-class p tag"]]) | |
(r/render | |
[my-app] | |
(js/document.getElementById "app")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── project.clj | |
├── resources | |
│ └── public | |
│ ├── css | |
│ │ └── main.css | |
│ └── index.html | |
└── src | |
└── min_css | |
└── core.cljs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link href="css/main.css" rel="stylesheet" type="text/css"> | |
</head> | |
<body> | |
<div id="app"></div> | |
<script src="js/out/goog/base.js"></script> | |
<script src="js/main.js"></script> | |
<script>goog.require('min_css.core')</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background: #ddd; | |
} | |
h1 { | |
color: #f00; | |
} | |
p { | |
font: 18px "Century Gothic", Futura, sans-serif; | |
} | |
.my-class { | |
font-size: 12px; | |
background: #ddf; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject min-css "0.0.1" | |
:dependencies [[org.clojure/clojure "1.8.0"] | |
[org.clojure/clojurescript "1.9.293"] | |
[reagent "0.6.0"]] | |
:plugins [[lein-cljsbuild "1.1.4"] | |
[lein-figwheel "0.5.7"]] | |
:figwheel {:css-dirs ["resources/public/css"]} | |
:cljsbuild | |
{:builds {:dev {:source-paths ["src"] | |
:figwheel true | |
:compiler {:output-to "resources/public/js/main.js" | |
:output-dir "resources/public/js/out/" | |
:optimizations :none}}}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment