0.1.0 • Published 9 years ago

generator-paper v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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 yo

To install generator-paper from npm, run:

npm install -g generator-paper

To set up a paper.js project in a folder, run:

cd my-new-project
yo paper

my-new-project ist just an example, it can be any folder you want.

To transpile the CoffeeScript to JavaScript, run:

gulp

Gulp 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.html with 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.html is the same as in the /src folder but we magically inserted <script> tags for all our dependencies. For example, the much-needed paper.js library. Open index.html in the browser to see your drawings.
  • script.js contains the transpiled JS from script.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 -save

To automatically inject our new dependency into index.html, re-run

gulp

This will add the appropriate <script> tag of your new dependency to index.html.

License

MIT

0.1.0

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago