The source of opentype.js is divided into modules, located in the src
directory.
We use browserify to combine this into a single package with every release.
When creating a pull request, you don't need to run npm run dist
-- we'll do that when creating a release.
-
On our GitHub page, click the "Fork" button to create your personal fork of the opentype.js repository.
-
Clone your repository:
git clone git://github.com/nodebox/opentype.js.git
-
Create a new branch for your feature. For example:
git checkout -b my-awesome-feature
. A dedicated branch for your pull request means you can develop multiple features at the same time, and ensures that your pull request is stable even if you later decide to develop an unrelated feature. -
Install the development dependencies (browserify, watchify, jshint, ...):
cd opentype.js npm install
-
Start the development server. This watches file changes and compiles and serves the page at http://localhost:8080/
npm start
Note that the compiled file ends up in the
build
folder, not thedist
folder! The development server rewrites the JavaScript URL fromdist/opentype.min.js
tobuild/opentype.js
. -
Make some changes
-
Check if tests pass (currently this just runs the code through JSHint)
npm test
-
Commit your changes
git add --all && git commit
-
Submit your pull request -- and thanks in advance!
If you want to create your own self-contained version of opentype.js, run
npm dist
This compiles the source and places opentype.js
and opentype.min.js
in the dist
folder.
We use a set of npm scripts to build releases:
- Update the version number in
package.json
andbower.json
. - Run
npm run dist
to update the files in thedist
folder. - Commit (
git commit -a
) and create a tag (e.g.git tag 1.2.1
). Push and push tags (git push && git push --tags
). - Run
npm publish
to publish the package to npm. Bower updates automatically.