npm install paper-loader paper --save-dev
The paper-loader requires paper and webpack
as a peerDependency
. Thus you are able to specify the required versions accurately.
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.
module.exports = {
...
module: {
loaders: [
{
test: /\.paper.js$/,
loader: "paper-loader"
}
]
}
};
MIT