Adding new example to quil.info
Clone this wiki locally
So you want to add your sketch to the examples on quil.info so everyone visiting site can see it. That's wonderful! We need a lot of various examples of what beautiful things can be done using Quil. Please make sure that your sketch satisfies following conditions:
- Sketch should work in different sizes: all examples are 200x200 sketches but the sketch should also work in 500x500 size as well.
There are 2 ways to add a new sketch.
Simple way - delegate
Create an issue in quil-site repo providing the source to your sketch. Someone from the Quil team will add it. If you have any problems - feel free to ask at clj-processing mailing list or create an issue in quil-site repo.
Advanced way - do it yourself
So you decided to do everything by yourself. Brave decision! Here is the outline of steps involved:
- Fork quil-site repo and clone to your computer.
- Create a new file under
your_sketch- actual name of the sketch. Please follow the style of other sketches in that folder, e.g. leaf.cljs. All lines that end with
;DELETEwill be removed from the sketch source when users open its source code.
- Run clojurescript compiler to check that everything compiles correctly
lein cljsbuild auto.
project.cljfile add new entry in
:cljsbuild -> :builds -> :modules. This is necessary because each example compiled as separate module (resulting in separate js file for each example). This way we can dynamically load only the modules necessary on a page. Unfortunately it means we have to list each example in
- Add new entry in
available-examplesvector in main.cljs. The name should match the name you used in step 1 in
lein cljsbuild autoand make sure it compiles.
- You're almost there! Start quil-site server
lein run -m quil-site.core/run 8080and open http://localhost:8080. You should see the main page. To force your example to be shown on the page add
?example=your_exampleto the url. Make sure your sketch runs correctly and then go to its source. Check the source and try to compile using
- Commit all changes (should be 3 files total), push to the github and open pull request.
- Please bear with us while we're reviewing and don't be angry if we ask you to fix some styling issues - we want all examples to have the same code style.
- Congratulations, your sketch is now on quil.info.
Example of adding "Tree" example: commit.
If you have ideas how to improve the workflow - please share.