generator-paper v0.1.0
generator-paper
A Yeoman generator to quickly set up a paper.js project. You'll write CoffeeScript, which is fun.
What you'll get
A folder where everything is set up so that you can start writing code for paper.js immediately. An html file, paper.js and CoffeeScript ready to go.
Getting Started
Install Yeoman:
npm install -g yoTo install generator-paper from npm, run:
npm install -g generator-paperTo set up a paper.js project in a folder, run:
cd my-new-project
yo papermy-new-project ist just an example, it can be any folder you want.
To transpile the CoffeeScript to JavaScript, run:
gulpGulp will now watch all .coffee files in my-new-project/src and transpile them to my-new-project/public.
How to use it
Write code in the src/ folder
Check out my-new-project/src. It contains
index.htmlwith a canvas element. Make markup changes here.script.coffee: Put your drawing wizz here. Note that you can't use PaperScript. Instead, write plain CoffeeScript. It's not so different though. See Using JavaScript directly in the Paper.js docs.
Find your changes in the public/ folder
Make sure you run gulp in the terminal as described above. Only when gulp is running the files from src/ are properly processed and placed in public/.
index.htmlis the same as in the/srcfolder but we magically inserted<script>tags for all our dependencies. For example, the much-needed paper.js library. Openindex.htmlin the browser to see your drawings.script.jscontains the transpiled JS fromscript.coffee.
Customize your project
Bower is set up and ready. Use it to manage frontend dependencies. For instance, to install jQuery, run
bower install jquery -saveTo automatically inject our new dependency into index.html, re-run
gulpThis will add the appropriate <script> tag of your new dependency to index.html.
License
MIT