mirror of
https://github.com/danbulant/pngjs
synced 2026-06-19 06:21:13 +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
|
||||
coverage
|
||||
examples/*.png
|
||||
browser\.js
|
||||
|
|
|
|||
12
README.md
12
README.md
|
|
@ -19,13 +19,13 @@ Known lack of support for:
|
|||
|
||||
* Extended PNG e.g. Animation
|
||||
* Writing in colortype 3 (indexed color)
|
||||
|
||||
|
||||
# Table of Contents
|
||||
* [Requirements](#requirements)
|
||||
* [Comparison Table](#comparison-table)
|
||||
* [Tests](#tests)
|
||||
* [Installation](#installation)
|
||||
* [Browserify](#browserify)
|
||||
* [Browser](#browser)
|
||||
* [Example](#example)
|
||||
* [Async API](#async-api)
|
||||
* [Sync API](#sync-api)
|
||||
|
|
@ -73,13 +73,13 @@ Installation
|
|||
$ 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
|
||||
==========
|
||||
|
|
|
|||
|
|
@ -34,9 +34,14 @@
|
|||
},
|
||||
"main": "./lib/png.js",
|
||||
"directories": {
|
||||
"example": "examples"
|
||||
"lib": "lib",
|
||||
"example": "examples",
|
||||
"test": "test"
|
||||
},
|
||||
"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-report": "npm run coverage && istanbul report html",
|
||||
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
||||
|
|
@ -52,6 +57,7 @@
|
|||
"url": "https://github.com/lukeapage/pngjs2/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^14.5.0",
|
||||
"buffer-equal": "1.0.0",
|
||||
"connect": "^3.4.0",
|
||||
"eslint": "^3.2.2",
|
||||
|
|
|
|||
Loading…
Reference in a new issue