mirror of
https://github.com/danbulant/pngjs
synced 2026-07-06 03:30:44 +00:00
Added a browserified version (#98)
This commit is contained in:
parent
7acfa680b1
commit
728cc7e265
4 changed files with 774 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@ node_modules
|
||||||
.idea
|
.idea
|
||||||
coverage
|
coverage
|
||||||
examples/*.png
|
examples/*.png
|
||||||
|
browser\.js
|
||||||
|
|
|
||||||
10
README.md
10
README.md
|
|
@ -25,7 +25,7 @@ Known lack of support for:
|
||||||
* [Comparison Table](#comparison-table)
|
* [Comparison Table](#comparison-table)
|
||||||
* [Tests](#tests)
|
* [Tests](#tests)
|
||||||
* [Installation](#installation)
|
* [Installation](#installation)
|
||||||
* [Browserify](#browserify)
|
* [Browser](#browser)
|
||||||
* [Example](#example)
|
* [Example](#example)
|
||||||
* [Async API](#async-api)
|
* [Async API](#async-api)
|
||||||
* [Sync API](#sync-api)
|
* [Sync API](#sync-api)
|
||||||
|
|
@ -73,13 +73,13 @@ Installation
|
||||||
$ npm install pngjs --save
|
$ npm install pngjs --save
|
||||||
```
|
```
|
||||||
|
|
||||||
Browserify
|
Browser
|
||||||
===========
|
===========
|
||||||
Use [Browserify](browserify.org) to build a version of library that can run client-side:
|
The package has been build with a [Browserify](browserify.org) version (`npm run browserify`) and you can use the browser version by including in your code:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ browserify lib/png.js --standalone png > bundle.js
|
import { PNG } from 'pngjs/browser';
|
||||||
```
|
```
|
||||||
Then depending on your module system you can either `require('bundle.js')` or if you're not using module loader you can use plain old `<script src="bundle.js"></script>` tag and the library will be available under `window.PNG` or just `PNG`.
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
==========
|
==========
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,14 @@
|
||||||
},
|
},
|
||||||
"main": "./lib/png.js",
|
"main": "./lib/png.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"example": "examples"
|
"lib": "lib",
|
||||||
|
"example": "examples",
|
||||||
|
"test": "test"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"build": "npm run prepublish",
|
||||||
|
"prepublish": "npm run browserify",
|
||||||
|
"browserify": "browserify lib/png.js --standalone png > browser.js",
|
||||||
"coverage": "istanbul -- cover node_modules/tape/bin/tape test/*-spec.js nolarge",
|
"coverage": "istanbul -- cover node_modules/tape/bin/tape test/*-spec.js nolarge",
|
||||||
"coverage-report": "npm run coverage && istanbul report html",
|
"coverage-report": "npm run coverage && istanbul report html",
|
||||||
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
||||||
|
|
@ -52,6 +57,7 @@
|
||||||
"url": "https://github.com/lukeapage/pngjs2/issues"
|
"url": "https://github.com/lukeapage/pngjs2/issues"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"browserify": "^14.5.0",
|
||||||
"buffer-equal": "1.0.0",
|
"buffer-equal": "1.0.0",
|
||||||
"connect": "^3.4.0",
|
"connect": "^3.4.0",
|
||||||
"eslint": "^3.2.2",
|
"eslint": "^3.2.2",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue