https://github.com/aprowe/paper-loader
PaperJs Loader for Webpack
https://github.com/aprowe/paper-loader
loader paper-loader paperjs webpack
Last synced: about 1 year ago
JSON representation
PaperJs Loader for Webpack
- Host: GitHub
- URL: https://github.com/aprowe/paper-loader
- Owner: aprowe
- Created: 2016-12-17T06:25:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-20T02:11:48.000Z (over 9 years ago)
- Last Synced: 2025-04-17T00:18:51.207Z (about 1 year ago)
- Topics: loader, paper-loader, paperjs, webpack
- Language: JavaScript
- Size: 5.86 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [PaperJS](http://paperjs.org) loader for [webpack](http://webpack.github.io/)
## Install
`npm install paper-loader paper --save-dev`
The paper-loader requires [paper](http://paperjs.org) and [webpack](https://github.com/webpack/webpack)
as a [`peerDependency`](https://docs.npmjs.com/files/package.json#peerdependencies). Thus you are able to specify the required versions accurately.
---
## Usage
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)
``` javascript
var executePaperScript = require('file.paper.js');
// Wait for canvas to be created
window.onload = function () {
// Call the module to create a paperjs scope and execute the code
var scope = executePaperScript('myCanvasID');
}
```
The module returns a function that can be called to create a PaperJS Scope.
It takes one parameter that sets up the view, and returns the scope created.
### Apply via webpack config
``` javascript
module.exports = {
...
module: {
loaders: [
{
test: /\.paper.js$/,
loader: "paper-loader"
}
]
}
};
```
## License
MIT