-
Notifications
You must be signed in to change notification settings - Fork 0
How to contribute to Fabric
If you think you found a bug in Fabric, please create a jsfiddle with a minimal test case, demonstrating the bug. In jsfiddle please link to the latest version of Fabric.js file - add the url to external resources (please use "rawgithub.com/" instead of "raw.github.com/". Why?). You can then create an issue with the link to jsfiddle. If you're unsure about something, it's best to create a post on Fabric's google group where someone might clarify some of the things.
If you're definitely certain about a bug or feature, please open a pull request (see "Using pull requests") with a fix/addition.
- JSON serialization
- SVG import
- SVG export
For example, let's say you wish to add another property to fabric.Text. This means that this new property needs to be present in at least fabric.Text#toObject, fabric.Text#toJSON outputs, and possibly in fabric.Text#toSVG output, as well as be accounted for in fabric.Text.fromElement (if there's analogous SVG feature).
Before filing a bug or adding a patch, you might want to get familiar with Fabric's architecture:
- http://www.slideshare.net/kangax/fabric-falsy-values-8067834
- http://www.slideshare.net/kangax/fabricjs-building-acanvaslibrarybk
- https://github.com/kangax/fabric.js/wiki/How-fabric-canvas-layering-works
gotchas:
or just general notes:
- 2 spaces, no tabs
- semicolons required
- explicit blocks
- camelCase
-
fabric.document
/fabric.window
(not justdocument
/window
)
Fabric uses JSDoc 3 for documentation. An example of documenting a method:
/**
* Capitalizes a string
* @memberOf fabric.util.string
* @param {String} string String to capitalize
* @return {String} Capitalized version of a string
*/
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
}
- Install Node.js
- Build distribution file
node build.js modules=ALL exclude=gestures
When fixing bugs or adding new features, it's highly advisable to add a corresponding unit test (under /test/unit, and under corresponding module). Fabric uses QUnit for unit tests. You can run entire test suite like so (from within Fabric's root directory):
> npm test
Fabric uses JSDoc-style documentation, right in the code. After adding or updating certain documentation, please open a pull request. You can also add or update a page on Fabric's github wiki.