Skip to content

Commit

Permalink
Initial commit, v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
beders committed Apr 13, 2020
1 parent 44bc6c5 commit 9310b54
Show file tree
Hide file tree
Showing 13 changed files with 1,387 additions and 8 deletions.
30 changes: 22 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
pom.xml
pom.xml.asc
*.jar
*.class
/lib/
/classes/
/target/
/checkouts/
.lein-deps-sum
.lein-repl-history
.lein-plugins/
.lein-failures
.nrepl-port
.cpcache/

node_modules/
examples/js
test/public/js

/target
/checkouts
/src/gen

pom.xml
pom.xml.asc
*.iml
*.jar
*.log
.shadow-cljs
.idea
.lein-*
.nrepl-*
.DS_Store

.hgignore
.hg/
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Rough-CLJS

A data-driven, reagent-wrapper for [RoughJS](https://roughjs.com/)

This library provides a simple reagent component for RoughJS which is a fun library to create diagrams that look hand-drawn.

See examples below.

# Installation

Get it from Clojars: `[monoid/rough-cljs "1.0"]`

If you are using [Shadow-CLJS](http://shadow-cljs.org/), it will download the JavaScript dependency automatically.

Otherwise, add RoughJS via NPM:
`$ npm install -D roughjs`

You will also need reagent 0.10.0 in your project.

# Usage

To use it, require it and add it to your hiccup:

```
(require '[rough-cljs.core :refer [Rough]])
(defn MyComponent []
[:div [Rough {:svg {:width 200 :height 200}} [[:rectangle [10 10 100 100] {:fill "blue"}]]]
```

> Note: Only changes to the drawing primitives have any effect when re-drawing this component.
All supported primitives like rectangle, circle etc. have been defined via spec.
(see rough-cljs/spec)

Check the docstring of `Rough` for more information.

# Examples

[This way please!](https://rough-cljs.netlify.com/)

# Build

Use shadow-cljs: `$ shadow-cljs watch app`

# Kudos

You guys rock:

- Preet Shihn - Author of [RoughJS](https://roughjs.com/)
- Thomas Heller - for [Shadow-CLJS](http://shadow-cljs.org/). Keeps me sane!
- [Reagent project](https://github.com/reagent-project/reagent) - super powers for React
- And the ClojureScript team of course
Binary file added examples/assets/GitHub-Mark-64px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Rough-CLJS Examples</title>
<link rel="stylesheet" href="https://cdn.rawgit.com/Chalarangelo/mini.css/v3.0.1/dist/mini-default.min.css">
</head>
<body>
<div id="app">
</div>
<script src="js/compiled/main.js" type="text/javascript"></script>
<script>example.init();</script>
</body>
</html>

0 comments on commit 9310b54

Please sign in to comment.